2

My goal is to debug Asp.net MVC 5.2.3 source code.

  1. I created Asp.net MVC application in Visual Studio 2013 and updated all NuGet packages.
  2. Set up VS2013 as described in https://referencesource.microsoft.com/setup.html
  3. Added http://referencesource.microsoft.com/symbols, https://nuget.smbsrc.net, http://srv.symbolsource.org/pdb/Public, http://srv.symbolsource.org/pdb/MyGet, http://msdl.microsoft.com/download/symbols https://nuget.smbsrc.net to symbols

But when I'm trying to "Step Into" View method of Controller I see "Controller.cs not found". When I'm trying to navigate to stack trace I see "downloading source code from https://nuget.smbsrc.net/" but the source code does not download.

Is it possible to debug source code of Asp.net MVC 5.2.3?

Update 1 I have changed symbols list. Actual is:

After this changes, in modules window exists next logs:

https://nuget.smbsrc.net: Symbols downloaded from symbol server. *****\AppData\Local\Temp\SymbolCache\System.Web.Mvc.pdb\5878BE5BDA9D485C84CA1F292E2AD75E1\System.Web.Mvc.pdb: Symbols loaded.

As we can see pdb file is loaded. But when I navigate to source code it won't open. enter image description here

It seems that source code does not exist on nuget.smbsrc.net

vmalyuta
  • 117
  • 11
  • Can you download the newest MVC source code by yourself? https://blogs.msdn.microsoft.com/micl/2014/06/06/how-to-debug-your-application-with-mvc-fresh-source-code/ and https://blogs.msdn.microsoft.com/webdev/2015/02/06/debugging-asp-net-5-framework-code-using-visual-studio-2015/ – Jack Zhai Jan 30 '17 at 08:41
  • 1
    @JackZhai-MSFT I already tried that. Compiling Asp.net mvc source code and including binaries to my projects allows me to "Step into" asp.net source code. But as for me it is a big workaround. I remember that several years ago I debugged source code without compiling, just simply configure the correct settings. I'm interested what happened from that time and what strange request to https://nuget.smbsrc.net. – vmalyuta Jan 30 '17 at 13:47
  • Gald to know that it is helpful even if it is a workaround for this issue. What I know is that the Microsoft symbols server didn't provide all symbols/source code for the entire .NET framework. From the old version like VS2010, we also download the source code manually: http://stackoverflow.com/questions/5827115/unable-to-debug-mvc-source-code-in-visual-studio-2010 – Jack Zhai Jan 31 '17 at 09:38

2 Answers2

4

I've found solution!

I set up VS as described on http://www.symbolsource.org/Public/Wiki/Using but with one exception. I've deleted http://srv.symbolsource.org/pdb/Public from symbol list. I noticed, symbols that downloads from http://srv.symbolsource.org/pdb/Public trying to download source code from https://nuget.smbsrc.net, but symbols that downloaded from http://srv.symbolsource.org/pdb/MyGet download source code from symbolsource.org.

If you want debug Asp.net mvc 5.2.3 just delete http://srv.symbolsource.org/pdb/Public from symbol list and ensure that pdb files downloaded from http://srv.symbolsource.org/pdb/MyGet

Ian Kemp
  • 28,293
  • 19
  • 112
  • 138
vmalyuta
  • 117
  • 11
1

I was not able to get the solution posted above working, but I did find another work around.

For viewing the actual source, I was able to open and view the source for any DLL files using dotPeek from JetBrains

For actually loading the source in visual studio, I was not able to navigate to the source using Go To Implementation (Ctrl+F12), but I was able to set a breakpoint through the debug menu, at which point visual studio would break and then allow me to view the implementation.

  1. Look up the full namespace method name of where you want to break using dotPeek
  2. In Visual Studio navigate to Debug > New BreakPoint > Function Breakpoint (Ctrl+B) and set the breakpoint on the function you found in JetBrains. Example: System.Web.Mvc.Authorization.AuthorizeCore
  3. Debug the application in Visual Studio and it will break at the point set, allowing you to step through and explore the source code for that function
Yuankun
  • 6,875
  • 3
  • 32
  • 34
ToDevAndBeyond
  • 1,120
  • 16
  • 24