Two week ago I blogged about .NET source code availability, mentioning that Kerem Kusmezer was working on an program to download the Microsoft .NET source code without having to rely on the latest version of Visual Studio, which many people don't have (myself included). As a comment to my blog, this morning Kerem left a message mentioning the tool in indeed available.

Called NetMassDownlaoder, this tool is available on Microsoft's open source projects repository, CodePlex, at the address http://www.codeplex.com/NetMassDownloader. The authors are Kerem (see the announcement on his blog) and John Robbins (his blog).

After some tribulation (I had to upgrade my .net 2.0 runtime to the latest versions), I could run the simple command-line program, and it did download 4,003 source code files, skipping 122, referenced by 8 PDB files (of course, you don't get the complete source code of the .net framework, but certainly large core parts). The over 4,000 files contain almost 72MB of source code. Some file are small, others are quite large like the 3,257 source code line of String.cs.

As you start downloading, of course, you need to accept Microsoft license agreement, granting the rights to access to this source code for "reference use". It specifically states you cannot "use the software for purposes of designing, developing, or testing other software, for a non-Windows operating system, that has the same or substantially the same features or functionality as the software" (I read it as a single word, "Mono").

Although I'm certainly used to browsing the VCL source code, I was somewhat thrilled of opening source code files of the .net framework using the Delphi .NET IDE (CodeGear RAD Studio, to be more precise). Now I immediately thought of posting an image here with the source code in RAD Studio, but that would violate the above agreement... so I'm not doing that (at least for now). I know you can find similar images based on Visual Studio, but I guess Microsoft employees have some extra rights.

Next, I've set up the debugger to point to the folder where the PDB files reside, and (at least by keeping the target source code files open or pointing to the proper source code folder for the given file to debug) I've been able to:

  • trace into the .NET source code
  • place breakpoints in it and see it stop as expected

As a proof, I've posted the following image, from a program that uses the ArrayList class. You cannot see the source code (I've made the windows small) but you can see the symbols in the debugger, including the values of the fields of the current ArrayList object in the Local Variables pane. So, you can read and debug the .NET framework source in RAD Studio like you can do in Visual Studio!