Scott Hanselman

Changes in the .NET BCL between 2.0 and 3.5

August 10, '07 Comments [8] Posted in Learning .NET | Programming
Sponsored By

(Actually between the BCL Version 2.0.50727.42 and 2.0 (Version 2.0.50727.1378)

API Changes from org2.0 to 2.0 - Windows Internet ExplorerI was thinking that while folks are blogging about all the new stuff in .NET 3.5 and VS2008 (or VS3.508 as I think to think of it) there must be other fixes here and there in the Base Class Library itself.

I googled around and couldn't find a list of what's changed in the BCL. I'm sure it's out there somewhere and I've missed it and the second I post this someone will post a better list in the comments, but anyway...

First, I look in C:\windows\assembly with Explorer. Remember that this is a "lie" - what you're seeing is a namespace extension's representation of the Global Assembly Cache, although a very useful one. Here's the new 3.5 stuff, sorting by version. This stuff is near all new. New assemblies, etc.

assembly

Nothing in here appears to have "rev'ed" like moving from 2.0 to 3.5 and kept the old version. One might expect to see System.Web 2.0 and then System.Web 3.5, but that's not the case from what I can see.

There is, however, a large amount of new (what I would call) BCL stuff in the new System.Core assembly. Remember that namespaces can exist across assemblies, so releasing a new assembly is a pretty decent way to get sweeping additive changes across a few dozen namespaces in a very compatible way.

Reflector says that System.Core includes new things in System.Threading, System.IO, System.Security, System.Diagnostics, and more. I would encourage you (as I do everyone who will listen) to download Reflector and do this:

  • Run Reflector
  • Hit the Home key on your keyboard
  • Hold down Delete until Reflector's window is clear
  • Press Ctrl-L, then Enter

...and you'll get this dialog. Reflector is smart enough to prompt you to fill up your empty assembly list, and the defaults are so useful that I usually just delete everything and pick one of these.

Start Default Assembly List

As you move around in Reflector, notice the "Location:" arrea at the bottom that tells you where the assembly is (although there are copies in the GAC).

image

Look at all the assemblies in the .NET 3.5 list and you'll see which ones live in the 2.0 directory, the 3.0 directory and the 3.5 directory.

While 3.5 is huge conceptually, on disk it's very small, consisting of the new compilers and basically these three assemblies:

  • System.Core
  • System.Data.Linq
  • System.Xml.Linq

There are other assemblies for MSBUILD improvements and such, but it's still very compact, from a "redistributable" point of view.

I would personally recommend that anyone who hasn't moved their 1.1 shop over to 2005, or who is starting out with .NET to just start with 2008/3.5. The multi-targeting stuff is very slick (I'll do a dissection soon, more detailed that ScottGu's post)

Has Anything Changed?

I wanted to find out what's changed between a standard Windows XP SP2 machine - totally fresh - with just the 2.0 runtime distributable installed, and my Vista machine with 3.5 on it.

There's a really great, but largely unknown, tool called Libcheck that you can download for free, that'll compare two versions of an assembly and show you the differences in a report. It'll look only at the public (inter)face of the assembly. In this case, that's exactly what I want.

It doesn't look to have been changed since 2005, so first I need to download and compiled it and hope it works. Fortunately it comes with source code and rather than spending time converting it to 2008, I just run the included nmake.bat that builds the three supporting libraries it needs and spits out libcheck.exe. Nice and easy (and lazy). There's a couple of obsolete warnings, but they're obsolete, not dead.

First, I brought up my 2.0 XP SP2 VM (again, fresh) and ran the .NET 2.0 Redistributable Package on it. This would be version 2.0.50727.42.

I went to the Libcheck folder and ran this command:

libcheck -store all org2.0

...and libcheck created a database of all the schmutz in 2.0.

Then I ran the same thing on my Vista machine with 3.5 - remembering that it's just going to look at the 2.0 Framework stuff on my system. This version of 2.0 was 2.0.50727.1378.

libcheck -store all 2.0

Notice that one was "org2.0" and the other '"2.0." I then copied all the org2.0 folder off my VM and onto my main machine, then ran:

libcheck -compare org2.0 2.0

The Report appeared in a folder called org2.0to2.0. Then I copied the report up to my blog, and it's available here.

Note: You can modify the text files in /RefFiles and use LibCheck on your own framework internal to your company. That's what we did at Corillian. There is apparently a much better version of this tool (this one is 3 years old) internal to Microsoft. I'll see what I can do to free it.

The percentage of churn was in the single digit percentages. Personally I find the report a fascinating read. You can see what was breaking, what was just added. You can see where new enums appeared and where overrides became virtuals and all sorts of things. Check it out, it's not that scary.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by ORCS Web
Friday, August 10, 2007 2:25:24 AM UTC
If you haven't seen it yet, check out Patrick Smacchia's analysis using NDepend's CQL queries:
http://codebetter.com/blogs/patricksmacchia/archive/2007/08/08/new-net-3-5-core-stuff.aspx

Serves as a nice analysis of the changes, while doubling as a great advertisement for NDepend.
Friday, August 10, 2007 3:59:24 AM UTC
That's slick! NDepend kicks so much ass.
Friday, August 10, 2007 9:45:48 AM UTC
Great list. Thanks Scott.
Friday, August 10, 2007 8:51:53 PM UTC
VERY interesting (approach and results alike). I was just wondering recently if anything was being added to System.Web. The one thing that popped out at me in that assembly was a bunch of ParseControl methods sprinkled around (Page, Master, UserControl to name a few). I'll have to play with those when my spare time meter gets some extra change...
Todd Price
Friday, August 10, 2007 9:23:21 PM UTC
I guess just the LINQ being added is already worth the +1.5 version shift already.
Friday, August 10, 2007 9:56:00 PM UTC
chakrit, I agree that LINQ is worth a 1.5 version shift, but nonetheless, v3.5 is just 0.5 shift overall ;)

...and, FWIW, I also thought that WPF alone was worth the shift from v2.0 to v3.0, even though we also got WF, WCF and CardSpace.

Cheers
Daniel
Saturday, August 11, 2007 7:10:50 AM UTC
Great list, saved to favorites. Thanks Scott
Dan
Tuesday, October 09, 2007 3:20:09 PM UTC
There is apparently a much better version of this tool (this one is 3 years old) internal to Microsoft. I'll see what I can do to free it.

Any luck with this Scott?
Bill Bott
Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.