Delphi 2007 Handbook








February 6, 2008

Debugging .Net Source Code in CodeGear RAD Studio

Thanks to the brand new NetMassDownloader utility, I've been able to access to the .NET framework source code and debug it in the Delphi .NET personality of CodeGear RAD Studio IDE.

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!





 

8 Comments

Debugging .Net Source Code in CodeGear RAD Studio 

 Cool, thanks very much for the information
Comment by John Moshakis [http://community.moshine.com/blogs/johnmoshakis/] on February 6, 20:42

Debugging .Net Source Code in CodeGear RAD Studio 

Sorry is this is slighty OT, but could your
recommended any good books for Delphi and .NET 2
(specifically ASP.NET)?
I am learning Delphi and .NET. Luckily I know Java so
I can work out most of the C# examples and convert
them to Delphi, but a dedicated book that taught RAD
Studio too would be really useful. Any ideas let me know.

Marc
Comment by Marc [http://imarc.co.uk] on February 7, 02:05

Debugging .Net Source Code in CodeGear RAD Studio 

Hello Marco, thanks for this.
Is this a Delphi .NET project or a CSharp project?
Comment by Sascha on February 7, 10:14

Now if only CodeGear delivered PDBs 

Now if only CodeGear delivered PDBs with Delphi we
actually could trace into the VCL too.
Comment by Lars Truijens [http://www.chipsoft.nl] on February 7, 10:58

Debugging .Net Source Code in CodeGear RAD Studio 

It's a Delphi for .NET project. All the tutorials on
ASP use c# or VB.NET examples, wondered if you knew of
any books that teach you it in Delphi. 
Comment by Marc on February 7, 21:01

Debugging .Net Source Code in CodeGear RAD Studio 

Thanks,
excellent !!
Comment by Softlion [http://www.softlion.com/] on February 9, 14:31

Debugging .Net Source Code in CodeGear RAD Studio 

Always good to read what you are doing.

Maybe with the screenshots you could "blur" the areas
you don't want people to see - just like on crime
programs on TV.
Comment by Cosmic [http://www.LeftClick.com] on February 12, 00:40

Debugging .Net Source Code in CodeGear RAD Studio 

MS pushing its Visual Studio is pretty boring 
sometimes
Comment by Yet another geek [http://sb2.info] on May 11, 21:10


Post Your Comment

Click here for posting your feedback to this blog.

There are currently 0 pending (unapproved) messages.