# Monday, November 21, 2005

We’re now at least half way into this set of posts on factoring features in Visual Studio 2005. The more I’ve thought about getting this set of posts fully written up, the more I’ve found these features interesting. My team produced them, so that helps, but I believe that a lot of developers will end up needing these features as a part of their versioning plan.

 

AKA InternalsVisibleTo

Friend assemblies are a nickname for the InternalsVisibleTo attribute in the System.Runtime.CompilerServices namespace. Not much of a stretch from the name, the use of the attribute allows you to specify which assemblies (your friends) should have access to your internal types and members. Just to remind you, “internal” != “private” – “internal” == “internal”.

 

As you might guess, this attribute must be set at the assembly-level. You might hope, however, that you could set this attribute at a more fine-grained level. I can explain that more later.

 

Syntax

The attribute is set in the following way:

 

[assembly:InternalsVisibleTo(“MyOtherAssembly, PublicKey=4asdsadasdsd”)

 

Couple things … The constructor of the attribute -- remember attributes are just types -- takes a textual assembly identity. Next, you must specify at least an assembly name and optionally a public key token. You can specify a culture as long as it is neutral. You cannot specify a version. Some of this may be a surprise to you. I’ll explain that below.

 

Design Decision Points

In retrospect, I’m not sure that making the public key token optional was the absolute best idea, but it was probably was necessary for a lot of interesting scenarios. First, friend assemblies is not a security feature, in the sense that visibility is not a security feature. Friend assemblies is just about changing the usual bounds of visibility to something that is more convenient for developers in a lot of cases.

 

That all being said, friend assemblies are really best kept to strong-named assemblies. Weak- or simple-named are very easily spoof-able (by definition). As a result, someone can simply use a particular name for their assembly and then get access to the internal fields in a simply-named assembly from which you’ve granted friendship. Even if you only ship your code internally within your business, this still isn’t a great plan. Think about it for a while and you’ll probably begin to better understand why.

 

It probably mostly goes without saying, but strong-named assemblies can only have strong-named friends. Strong-named assemblies can only depend on strong-named assemblies, so this point is moot anyway.

 

I do feel strongly that disallowing the version number was the right thing to do. The reason for that is that CLR binding doesn’t always produce the version of an assembly that you expect. There are a lot of mechanisms that can be at play, such as publisher policy, binding-redirects and other binding/versioning changes that we have planned for the CLR v3. As a result, you cannot assume that an assembly that depends on you is always going to be the same. Remember, with friends, it isn’t that you are assuming that a dependency of yours is going to be a particular version, but an assembly that is dependent on you. We would have potentially made a different decision if friends was the opposite way around, being a statement about your dependencies, but it isn’t.

 

The ability to specify culture provided that it is neutral is mostly a red-herring. There is no harm to specifying it, which is why we allowed it, but it is best to think in general that culture isn’t allowed. The main reason here is that you should not have code in culture-specific assemblies.

Monday, November 21, 2005 6:46:14 PM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [0]  | 
# Thursday, November 17, 2005

I'll be attending the Visual Studio 2005 launches in both Vancouver and Calgary next week.

I'm definitely looking forward to both. I'm up to Vancouver all the time, being only about 2 hours to the Canadian border from Redmond, plus parts of my family lives in Cloverdale. I'm very curious what the Vancouver .Net crowd is like. I have to admit that the Toronto crowd blew me away, with a turnout of >3000 developers and IT professionals. I guess I should admit that a bunch of those might just have happened to be there for SQL Server 2005 or Biztalk 2006. That being said, it did seem like the VS 2005/.NET Framework "experts" in the "Ask the Experts" area were particularly busy.

I haven't been to Calgary since ~2001. My best friend lives there, so we'll likely hit the slopes (Rockie mountains) if the weather co-operates.

Please introduce yourself at the launches if you are able to make it. I'll be in the experts area most of the time. Also, please mail me if you'd like to setup some time to meet, either at the launch or elsewhere, to discuss development issues. I had good luck meeting with banks in Toronto and would like to have similar meetings in the West. I guess I should ring up the oil patch while in Calgary and see how they're using .Net.

Us "experts" typically have dinner together directly after the launch. Please mail me if you'd like to join us. This is a good chance to spend 90mins with the likes of John and Jerome. John refers to himself as a plumber.

Thursday, November 17, 2005 5:50:54 AM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [0]  | 
# Tuesday, November 15, 2005

Most blog engines support some notion of referrers, listing where your traffic came from. This includes search engines and the search terms that were used. There are definitely some strong trends, largely related to what MSN Search and Google think my blog is about. If I wrote about new moons being discovered in pluto's orbit, then I'd start to get more traffic on that.

That all being said, I'm getting a fair number of searches coming through on gacutil v2.0. That isn't strange on its own. I'm glad that folks are using it. My question is what in particular folks are searching for. If you are one of those folks that are searching for something on gacutil v2.0 in VS 2005, please enter a comment below describing the data that you are looking for. Feel free to mail me @ rlander@microsoft.com.

As an aside, I get pretty much no spam at the address above, which is why I don't mind listing it. The combination of Exchange 12 and Outlook 2003 must be pretty amazing at eating spam. I'm on Exchange 12 dogfood, as is the rest of the CLR team.

Tuesday, November 15, 2005 5:30:02 PM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [0]  | 
# Friday, November 11, 2005

What does the following C# code do? Guess and then run it.

using System;
using System.Threading;

namespace AnonMethods
{
class Program
{
static void Main(string[] args)
{
for (Int32 i = 0; i < 20; i++)
{
Thread t = new Thread(delegate() { Thread.Sleep(10); Console.WriteLine(i); });
t.Start();
}
Thread.Sleep(5000);
}
}
}

We were playing with this and similar code in the experts area at the Ottawa VS launch yesterday. Fun, fun.

My task ahead is to find a scenario that makes the subtleties of anonymous delegates useful. Anonymous delegates are certainly useful. It is the trick above with "i" that I'm talking about. I'll post in a couple days with more data on what is going on.

Friday, November 11, 2005 2:51:50 PM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [1]  | 

Today marked the second of ten stops on the Canadian launch of VS 2005, in Ottawa. You can check out launch pics @ flickr. Looks like the pics are limited to Toronto at this point, but I expect that to change over the next few days.

 

The Ottawa launch was another success. It was definitely more cozy than Toronto, being in a hotel, rather than a convention center. This different actually had its benefits. Faces started looking familiar more quickly and people didn't get lost ;)

 

The ask the experts area was staffed by a bunch of the same experts as Toronto. By the second go, we definitely had our act together. For example, we did a better job of getting the best person to answer questions. I don't know a lot about databases or of our System.Data classes. Fortunately, Bruce Johnson did, another .Net expert from ObjectSharp.

 

I managed to break away from the experts area for a while to go see one of the talks. Gotta say that Jerome and Barry did a great job. John also did a great job during the keynotes. I didn't get to see him in action during the talks.

Friday, November 11, 2005 6:33:25 AM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [0]  | 

The Ottawa launch started with us arriving in town last night. Ottawa is one of my favourite cities in Canada, and certainly my favourite in Ontario. As a result, I was really looking forward to it. The trip started a little rough with a couple flights to Ottawa being cancelled and then me forgetting my jacket at gate 122 in Toronto airport. The dumb part is that they announced a lost jacket just before the plane left the gate (with everyone seated), but I was already deep into conversation with my two seat-mates. Anyway, a quick call to Toronto Airport from Ottawa solved the problem after I was patched back through to gate 122. The jacket was there and we were good to go. My Swanndri jacket is particularly important to me as I picked it up when Annie and I were married in New Zealand five years ago.

We drove from the airport to Microsoft Canada. We were late and were denied admittance at first by building security at Microsoft Ottawa. Note that the building has several tenants, so security was not MS-specific. Anyway, we explained the situation and got past that. Odd. We then spent the next hour with a bunch of local Ottawa .Net folks. We had some great conversations with the local developers over beer and cheese. I spent about 30mins talking with one guy in particular. We had a very interesting conversation about dynamic languages and some of the subtleties of anonymous delegates and methods in C#. I certainly knew about anonyomous delegates, but didn’t know about the subtleties that he mentioned. We talked more about the way that these work today at the launch and I now have a better idea. I’ll post more on this later.

After the beer and cheese, we headed to dinner with Barry Gervin of ObjectSharp. He's the left-most guy in this pic. Definitely a very smart guy. He's a regional director for a bunch of Microsoft technologies and also seems to like Italian food.

Friday, November 11, 2005 5:55:22 AM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [0]  | 
# Thursday, November 10, 2005

Wow! The Toronto launch was pretty amazing. There were apparently >3000 people there. The keynote presentation was pretty good. It was more marketing-oriented than anything technical, which is to be expected from a launch event.

 

I really enjoyed the ~5 3-5 minute videos that they played at the launch. For me, they are more interesting than slideware and also much more compelling. “Here are some real-life customers who might even be part of your industry who are using Visual Studio 2005 and .NET Framework v2.0.” About half the videos were of American or International companies. The other half was impressively Canadian. I was surprised and very happy that Microsoft Canada had taken the time to create videos of customers using VS and the .NET Framework from all over Canada. Being Canadian, that really helps make the whole thing more credible.

 

Also, all the speakers wore poppies. Nice touch guys. I’m sure that I wasn’t the only one who noticed that detail. This attention to detail was most impressive to me with Craig (Symonds), who like me is Canadian but came from out of town (Redmond). With all the last minute details related to the launch, I could easily see how he would have forgotten to wear a poppy. I’m sure that the launch team helped with that, but it was still a nice touch.

 

Anyway, on to the more interesting data. The whole event started off with a keynote. It was dark in the big room with lots of flashing lights and these huge clear balls with some kind of wide tinsel flying around side, bouncing from one side of the building to another. Wild. You can get an idea of the excitement in the room via the picture below, taken about 20mins before the event actually started and before everyone got into the room (hence the empty chairs at the back).

 

keynote room 

 

I didn’t go to any of the sessions. I had the pleasure of hanging out in the Cabana or “Ask the Experts” area. I was there for several hours straight – even during lunch – answering many many questions of the folks that came in. There were 20 or so “experts” in the room, but it seemed like folks were lined up most of the time, waiting to talk with us. It was actually pretty crazy. There were a bunch of questions that I couldn’t answer, being too far out of my area. As a result, I handed out about 30 or so business cards, asking people to contact me later with their questions, which I would then hand off to the actual experts.

 

Several folks commented that the major value for them was the experts area. They definitely got value out of the other aspects of the event, but were able to drill down pretty deeply into areas that mattered to them with the experts. Very cool. See a pic of the experts area below.

 

cabana area

 

To end the day, we (all 3000+ of us) got a grab bag with VS 2005 and SQL Server 2005 (both standard non-trial versions). I imagine that a lot of folks were pretty excited by that. They already could download the Express SKUs from MSDN, but getting the real thing is a pretty cool deal.

 

I met with two companies today in Toronto, both banks. It is interesting to see what kind of projects that they are taking on and where they are and are not choosing to use the platform. In most cases, the “are not” scenarios are mostly for historical reasons and will change over time. It is most interesting to see where their pain points are. We’re about to start a new release and have the opportunity now to look at addressing significant problems. For the last year, we’ve been pretty locked down on Whidbey, not allowing us to implement significant solutions to issues that customers have encountered. It is a breath of fresh air to be in a different mode. I’m looking forward to meeting with customers, learning about what sort of improvements/features that they want and then brewing that all up in the feature mash to come up with something great for CLR v3.

 

I’m in the airport right now, waiting to head out to Ottawa in about 40mins. The flight is ~60mins. At 6 (or as soon as I can get there since I’m landing at 5:40), I’m going to attend another pre-launch event at Microsoft Ottawa. I’m guessing that this is going to be another “Beer and Cheese”. We shall see.

 

The MVP/Influencer type events are generally my favourite. The folks that attend them have generally invested a lot of time and passion into .NET development, so by definition have a lot of depth and opinion on the subject. As a result, you can have some pretty interesting conversations with these guys. They also don’t hesitate to push back on certain things. Constructive (and sometimes not that constructive) criticism is very helpful and does affect the designs that we decide on and implement.

 

And of course, I’m really looking forward to the launch event tomorrow! See you there.

Thursday, November 10, 2005 4:39:58 AM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [0]  | 
# Tuesday, November 08, 2005

I just got back from the pre-launch event. It was pretty much a "beer and cheese". Got to love those. We're doing them all the time in Redmond.

I got talking to a few guys for most of the time. It is amazing to hear folks from back home speaking so authoritatively about the platform that you work on! John, pictured below, had a lot of interesting things to say about ASP.Net. I definitely understood where he ws coming from and had had some of the same experiences. He also made some interesting comparisons with Ruby. It certainly does seem like dynamic/scripting languages are rising in popularity.

Here's a picture of the 3 guys I talked to most. Of the 4 guys pictured, I'm the one on the left with the brown shirt. The other guys from the left are Obi, Richard and John.

geek power

Time to go to bed. I'm still on Pacific time, but won't feel much like that when I need to get up on Eastern time for the launch!

Tuesday, November 08, 2005 6:02:07 AM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [0]  | 

I started my day at 6AM, which is earlier than normal. I haven’t set the alarm for work since my daughter was born, always waiting for her to wake us up, which is generally earlier than desired. The alarm and 6AM wake-up didn’t hurt much though.

 

The cab came by at 7:10AM, 20 mins late. That was OK though, as I booked it 10mins earlier than I needed. Also, my daughter didn’t wake up until 6:55, so I would have missed her by 5 mins if the taxi had arrived on time, which would have put a lot worse feeling on the day.

 

For some strange reason, I opted to fly to Vancouver and then to Toronto. We always fly direct on Air Canada from SEA (Seattle) to YYZ (Toronto). Actually, I didn’t choose to do it; it was a mixup on my part of understanding how to use our travel booking website. Better luck next time. It adds 3 hours (or so) to the trip to Toronto, but that’s OK. Vancouver airport is one of the nicest that I’ve ever had the pleasure of visiting. Seattle’s is pretty bad in comparison.

 

Now I’m on the flight from YVR (Vancouver) to YYZ. Interestingly enough, Air Canada decided to cut free in-flight meals last week. I applaud the change, actually. I care a lot about the food I eat, both from the standpoint of nutrition and taste. Airplane meals, as you know, generally lack in both categories. It would be great if appropriate price cuts accompany the reduction of service.

 

The guy just came by asking “anything from the restaurant”. Last time I checked, a rolling cart with a bunch of pre-packaged food on top didn’t count as a restaurant!

 

I opted for lunch at Whitespot, a household name in Vancouver. They even have Whitespot available on the BC fairies. I opted for a veggie burger and a salad. I’m feeling pretty good about that after seeing what folks are ordering on the flight. Maybe next time, I’ll bring a steaming Indian curry on to the plane. Either that or a Coleman stove and a filet of salmon to bake.

 

Enough of the logistics … I’m really looking forward to the launch. I’m heading to a pre-launch event at a restaurant on Dixon (Lonestar Texas Grill) as soon as I land. I believe that I land at something like 7:24PM and the event starts at 7:30PM. Watch in-flight feature film “Must love dogs” à Land à Deplane à Get baggage (1 item) à Get Taxi à Enter restaurant à Order supper à Watch meal get cold as I talk Whidbey with .NET MVPs.

 

Craig Symonds is doing the keynote tomorrow in Toronto. Craig is the General Manager of the Visual Studio division. Surprisingly enough, they produce this thing called Visual Studio. I’m in its sister/brother division called NDP or .Net Developer Platform, which produces the .NET Framework. I don’t exactly work with Craig, as he’s an executive and I’m an “individual contributor”. That being said, I work with folks from his division all the time, generally working on two things: designing/implementing VS/.NET Framework integration and determining which product a given bug resides it (it often isn’t clear on first look). Actually, the last part is the most interesting to me. More on that another time.

 

Last I heard, there are four or five thousand people registered for the Launch event in Toronto. I also heard – and I think that this is amazing – that all attendees are being given a fully-fledged version of VS 2005 and SQL Server 2005. Wow! The VS version is apparently a “special edition”. I have no idea what that means, but the product is apparently not time-bombed or crippled in any way. It might just be a special box, which would actually be kinda cool. I have a special Windows XP box that I was given for working on that, and I still get a kick out of that.

 

Hope to see you there … or in Ottawa a couple days later.

Tuesday, November 08, 2005 1:09:13 AM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [0]  | 
# Thursday, November 03, 2005

I'm being sent to Toronto and Ottawa to participate in the VS 2005 launches there. I guess I was picked since I'm a native speaker ;)

If you are going to be there too, it would be great to meet up to talk about Whidbey. I believe that I'm going to spending most of my time at the "Ask the Experts" desk/area/table. Come by to chat, ask questions or bring your laptop stopped at your favourite breakpoint in the VS debugger.

I also have a bit of time on the 8th and 9th (in Toronto) and 10th and 11th in Ottawa if you'd like to meet to talk about .NET Framework development that you are (or are planning to be) doing. Please mail me @ rlander@microsoft.com if you'd like to meet (at the launch location, Starbucks or your location).

I'm also planning to attend the Vancouver and Calgary events. I'll post more on that after the Ottawa and Toronto events.

Thursday, November 03, 2005 9:58:12 PM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [0]  |