Debugging Asp.net MVC 5.2.3 source code

2020-03-30 02:22发布

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

2条回答
霸刀☆藐视天下
2楼-- · 2020-03-30 02:44

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
查看更多
够拽才男人
3楼-- · 2020-03-30 02:48

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

查看更多
登录 后发表回答