2

I wanted to step inside/debugging the web-api 2 (version 5.2.3) code source to understand it.

I've created a simple web api application, and in the WebApi.config, I've set a break point at this line:

 config.Routes.MapHttpRoute(
           name: "ExcludedRoute",
           routeTemplate: "api/{controller}/{action}",
           defaults: new { id = RouteParameter.Optional },
           constraints: new { Controller = "healthcheck", action = "check" }
       );

I could step inside the MapHttpRoute method and the other classes, but the debugger couldn't step inside the Route class from the System.Web dll, below the image:

enter image description here

I tried to use this symbol file locations:
enter image description here

I've also used the dotpeek tool for generating the pdb files from the bin folder, by setting to true the "copy local" feature of the referenced assemblies, but with no success. The path of system.web dll is

C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\System.Web.dll

I'm wondering Why the debugger couldn't step inside the Route class which belongs to the system.Web dll, its version is 4.0 and the version of web.api is the 5.2.3.

In my searching, I've downloaded the code source of the asp.net and i found that the project System.Web.Http.WebHost which contains the HttpWebRoute class.

Any idea?

Thanks!

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
Issa Dawaji
  • 183
  • 1
  • 12

1 Answers1

0

Assembly System.Web.pdb was in the .NET Framework source code. You need to configure Visual Studio for debugging .NET framework in the Tools -> Options -> Debugging -> General menu.

Reference:

How do I debug .NET 4.6 framework source code in Visual Studio 2017?

Jack Zhai
  • 6,230
  • 1
  • 12
  • 20
  • As i mentioned in my question, i've configured visual studio with the standard source servers, but the result was not good. I've prefered to use the dotpeek tool to generate the pdb files, but even with that, the system.web.pdb didn't allow me to step inside the route class. – Issa Dawaji Dec 07 '17 at 13:28
  • @Issa Dawaji, So you set the correct settings like this document:https://referencesource.microsoft.com/setup.html, am I right? If so, do you get any warning or error messages during you debug your app? – Jack Zhai Dec 08 '17 at 07:27