45

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?

20
  • 1
    Any change that you build the project in Release mode? Commented Mar 3, 2013 at 12:43
  • 5
    Download a free trial of .NET Reflector. Install it and make sure it also installs the VS 2012 plugin (VS should be closed). Then follow the instructions in their documentation on how to make it so as that a referenced assembly which is not part of your solution is debuggable as if it were... Commented Mar 3, 2013 at 12:46
  • 1
    Yes I have also followed this, blogs.msdn.com/b/dotnet/archive/2012/08/15/… Commented Mar 3, 2013 at 13:57
  • 1
    @Matt is you are debugging the .NET framework code or just your code Commented Mar 3, 2013 at 16:01
  • 1
    I've got the same issue, followed the instructions didn't work, played around with all the settings still no luck Commented Mar 15, 2013 at 1:11

6 Answers 6

9

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:

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

Sign up to request clarification or add additional context in comments.

1 Comment

was it rebroken again? their steps at referencesource.microsoft.com/setup.html don't work.
9

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.

13 Comments

What feature is broken exactly? The incorrectness of the pdbs shouldn't count that much after we uncheck "Require source files to exactly match the original version". In general, the symbol debugging feature and system pdb handling improved 2008->2010->2012. But this thing: debugging into the .NET source is different.
Feature in the name of the question.
Indeed, the general agreement seems to be that the feature is broken.
I don't think it's due to the version of Visual Studio, or the fact the feature doesn't work, it's just the only source (or PDB+source information) that was available was for .NET RTM version, and not all the service packs and updates that were released continuously after that holly point in time. @user626528 - do you have "alternative solutions"?
@BrainSlugs83, ughm, you can just try to make it working on a fresh VM installation. If you have any luck with this - let us now.
|
7
+50

In VS 2008 I was able to debug .Net source, but in VS2012 I've got .NET Reflector (VS extension) installed, so it automatically decompiles and allows to debug any .Net code.

Another open source tool is ilspy.net , it saves the decompiled assembly as C# project and you can use the debugging tools.

There are also debugging tools for Windows, that come as part of SDK, but i haven't tried those: http://msdn.microsoft.com/en-us/windows/hardware/gg463009.aspx

2 Comments

I didn't realize ILSpy could output an entire CSPROJ, NEAT!
Huh, on second though, the output project has lots of weird issues, missing the XML comments is a pretty huge one...
2

Here is a nice post describing how to configure VS symbol server and dotPeek 1.2 to debug decompiled code from VisualStudio: http://blog.jetbrains.com/dotnet/2014/04/09/introducing-dotpeek-1-2-early-access-program If debugging framework or other compiled code is your daily routine I would recommend to reconstruct solution from set of assemblies you use that will save time on symbols loading during debugger attach.

Comments

1

1) PDB files are not up to date. Try to uncheck Tool->Options->Debugging->General->"Require source files to exactly match the original version"

2) You've referenced another of your projects byadding it's dll to your references instead of adding the project as reference. Try to remove the reference add add a new reference to the project from the "Projects" tab

And you can search Google .It's giving more than answers

Comments

1

I've had much luck in the past following the procedure as adviced by SymbolSource.

If you combine this with Resharper, you'll be able to CTRL-click your way through the framework.

There's a long history however of MS not publishing the code of all versions of their binaries. That's why often debugging won't work.

Still, Resharper seems a bit more flexible in downloading source code, and if it can't, it'll give you the disassembled source code, yet undebuggable. Note that JetBrains considers the debugging of decompiled sources a critical feature for dotPeek (the decompiler that comes with Re#), so it might be possible within a not too distant future.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.