Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debug .NET Framework Source Code in Visual Studio 2012?

I am using Visual Studio 2012. I want to Debug .NET Framework source code. I have tried nearly all the options but I am still getting There is source code available for Current Location. Symbols are loaded successfully. I have tried loading Microsoft Symbol Server and tried this url http://referencesource.microsoft.com/symbols. But I am still unable to DEBUG. I have tried these links, http://blogs.msdn.com/b/sburke/archive/2008/01/16/configuring-visual-studio-to-debug-net-framework-source-code.aspx and http://msdn.microsoft.com/en-us/library/cc667410.aspx

Also followed this, http://blogs.msdn.com/b/dotnet/archive/2012/08/15/announcing-the-release-of-net-framework-4-5-rtm-product-and-source-code.aspx

Is anyone able to DEBUG .NET Framework source in VS 2012?

like image 864
Imran Qadir Baksh - Baloch Avatar asked Mar 03 '13 12:03

Imran Qadir Baksh - Baloch


People also ask

How do I debug .NET code in Visual Studio?

Open the Debug view by selecting the Debugging icon on the left side menu. Select the green arrow at the top of the pane, next to . NET Core Launch (console). Other ways to start the program in debugging mode are by pressing F5 or choosing Run > Start Debugging from the menu.

How do you debug a source code?

To use source debugging, you must have your compiler or linker create symbol files (. pdb files) when the binaries are built. These symbol files show the debugger how the binary instructions correspond to the source lines. Also, the debugger must be able to access the actual source files.

How do I debug .NET core source?

To debug . NET and ASP.NET Core source code in Visual Studio: In Tools -> Options -> Debugging -> General, un-check Enable Just My Code. Verify Enable Source Link support is checked.


2 Answers

Debugging .NET Framework sources was broken for a long time. See the relevant suggestion on VisualStudio UserVoice Allow developers to step through .NET Framework sources. Good news: it was finally been fixed! See the following blog post from Microsoft:

A new look for .NET Reference Source

In short:

  • New web interface for browsing sources: http://referencesource-beta.microsoft.com/
  • All sources, including project files, can be downloaded directly: http://referencesource-beta.microsoft.com/download.html (not compilable though)
  • There's a new extension for F12 navigation: http://visualstudiogallery.msdn.microsoft.com/f89b27c5-7d7b-4059-adde-7ccc709fa86e
  • Sources are always up to date and debugging isn't broken by patches and updates.

It's currently "beta". Eventually it's going to replace http://referencesource.microsoft.com/. Microsoft also promises to add sources of more assemblies.

like image 103
Athari Avatar answered Oct 16 '22 19:10

Athari


This feature was broken in VS2010 SP1, it might be broken in VS2012 as well. Or Microsoft might release incorrect PDB files for the latest .NET Framework version (this had happened before). Try alternative solutions. I'm using .NET Reflector VSPro - it allows to decompile assemblies, load decompiled symbols during debugging and use full debugging features for these decompiled assemblies.

like image 9
user626528 Avatar answered Oct 16 '22 20:10

user626528