Scott on Writing

Musings on technical writing...

Exploring the Code for the New .NET 3.5 Classes

I often use the free and awesome decompiler Reflector to peer into the source code of Microsoft's .NET Framework. It's an indispensable tool. However, I had a little difficulty viewing the underlying source code for some of the new .NET 3.5 classes. In particular, for a recent article I was interested in looking at what was happening underneath the covers when the DataPager control was rendered. The DataPager is a new control in ASP.NET 3.5 used to render a paging interface for the ListView control (also new to 3.5).

By default, Reflector had the v2.0 assemblies loaded. “No problem,” I thought, “I'll just navigate to the 3.5 assemblies in the %WINDIR%\Microsoft.NET\Framework folder and open the System.Web assemby from there. While there is a 3.5 subfolder there, it only includes a sprinkling of assemblies, and none of the 3.5 assemblies I was interested in. The .NET 3.5-specific classes are installed in the GAC in the System.Web.Extensions.dll assembly. Reflector, it appears, can't locate this assembly and I couldn't reach it through Windows Explorer.

I was able to use Reflector to dig into this assembly, but I'm sure there's an easier way to do it. I'm going to share my approach, but I invite anyone who knows of a simpler technique to post instructions in the comments. One possible solution would be to update Visual Studio 2008 so that the .NET Framework code can be stepped into during debugging. I tried applying the hotfix a while back and got an error, and have not yet taken the time to investigate the error further. With the .NET Framework source code integration can you view the source code through VS 2008 like with Reflector, or is the code only accessible when debugging?

To open the System.Web.Extensions.dllfrom Reflector, perform the following steps:

  • Drop to the command line (Start / Run / cmd.exe)
  • Navigate to the appropriate GAC folder, %WINDIR%\assembly\GAC_MSIL\System.Web.Extensions\3.5.0.0__31bf3856ad364e35\
  • Copy the System.Web.Extensions.dll to another location on my hard drive (such as C:\MyAssemblies\).
  • Once the assembly is “freed” from the GAC, you can open it in Reflector as you would any assembly

Hope this helps!

UPDATE FROM JAMES NEWTON-KING: “You can access the 3.0 and 3.5 assemblies at C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5” (That sure simplifies things!)

posted on Thursday, February 14, 2008 11:08 AM

Feedback

# re: Exploring the Code for the New .NET 3.5 Classes 2/14/2008 12:08 PM James Newton-King

Scott you can access the 3.0 and 3.5 assemblies at C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5

# re: Exploring the Code for the New .NET 3.5 Classes 2/14/2008 12:25 PM Scott Mitchell

James, thanks for the heads up. That sure makes it easier than having to dig through the GAC.

# Exploring the Code for the New .NET 3.5 Classes 2/14/2008 12:30 PM DotNetKicks.com

You've been kicked (a good thing) - Trackback from DotNetKicks.com

# re: Exploring the Code for the New .NET 3.5 Classes 2/14/2008 12:34 PM Joshua Johnson

Scott, have you seen this blog post from John Robbins about downloading the .NET 3.5 Source Code using a new utility? http://www.wintellect.com/cs/blogs/jrobbins/archive/2008/02/07/net-mass-downloader-1-1-released.aspx

and

http://www.wintellect.com/cs/blogs/jrobbins/archive/2008/02/14/net-mass-downloader-1-2-released.aspx

# re: Exploring the Code for the New .NET 3.5 Classes 2/14/2008 11:03 PM Stuart Leeks

You can also go to File\Open Cache in Reflector and then type System.Web.Extensions. Reflector will search through the GAC and list any extensions that match. It can take a while with several versions of .Net installed, but it's an easy way to get at assemblies in the GAC.

Title:  
Name:  
Url:
Protected by Clearscreen.SharpHIPEnter the code you see:
Comments   

Add To Your Reader

My Links

Archives

Post Categories

 

I am a Microsoft MVP for ASP.NET.
I am an ASPInsider.
<May 2008>
SMTWTFS
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567

Comment Stats

DayTotal% of Total
Sunday 1866.8%
Monday 37913.9%
Tuesday 45316.7%
Wednesday 50418.5%
Thursday 53519.7%
Friday 49418.2%
Saturday 1666.1%
Total 2717100.0%

Hour1Total% of Total
12:00 AM 652.4%
1:00 AM 682.5%
2:00 AM 622.3%
3:00 AM 742.7%
4:00 AM 572.1%
5:00 AM 1033.8%
6:00 AM 1084.0%
7:00 AM 1585.8%
8:00 AM 1716.3%
9:00 AM 1475.4%
10:00 AM 1716.3%
11:00 AM 1816.7%
12:00 PM 1886.9%
1:00 PM 1696.2%
2:00 PM 1605.9%
3:00 PM 1324.9%
4:00 PM 1073.9%
5:00 PM 923.4%
6:00 PM 913.3%
7:00 PM 963.5%
8:00 PM 833.1%
9:00 PM 782.9%
10:00 PM 792.9%
11:00 PM 772.8%
Total 2717100.0%

Comments by Blog Entry Date/Time

Day Entry MadeAvg.Total
Sunday 5.54144
Monday 5.22339
Tuesday 4.28419
Wednesday 7.67637
Thursday 6.90607
Friday 5.48411
Saturday 5.33160
Total 5.842717

Hour1 Entry MadeAvg.Total
12:00 AM 5.0035
1:00 AM 1.002
5:00 AM 0.000
7:00 AM 7.0035
8:00 AM 5.35107
9:00 AM 6.32278
10:00 AM 6.47246
11:00 AM 4.41181
12:00 PM 6.88330
1:00 PM 3.00111
2:00 PM 5.41222
3:00 PM 8.64285
4:00 PM 4.0589
5:00 PM 5.92154
6:00 PM 4.52113
7:00 PM 9.67174
8:00 PM 9.80147
9:00 PM 5.05111
10:00 PM 5.4265
11:00 PM 4.5732
Total 5.842717

Learn More About Comment Stats
1 - All times GMT -8...


Blog Stats

Favorite Web Sites

My Books

My MSDN Articles