Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I debug into asp.net core source code?

How can I attach the MVC 6 source code or dlls into my project so that I could debug into it. I need to see the actual flow of few things.

like image 851
eadam Avatar asked Jan 12 '15 23:01

eadam


People also ask

How do I debug ASP NET code in Visual Studio?

ASP. NET Core In Tools -> Options -> Debugging -> General, un-check Enable Just My Code. Verify Enable Source Link support is checked. In Tool -> Options -> Debugging -> Symbols, enable Microsoft Symbol Servers. When you step into any .NET or ASP.NET Core code, Visual Studio displays the source code. For example:

How do I debug NET Framework source code?

To debug.NET Framework source, you must: Enable stepping into.NET Framework source. Have access to debugging symbols for the code. You can choose to download debugging symbols immediately, or set options for later downloading.

How do I debug my application using the debugger?

Debug your application; set a breakpoint to the line of .NET code you wish to debug, and step to the desired code line with the debugger. Note: your application may start slower since it will download PDBs from the internet.

How to enable source link support in Visual Studio Code?

Verify Enable Source Link support is checked. In Tool -> Options -> Debugging -> Symbols, enable Microsoft Symbol Servers. When you step into any .NET or ASP.NET Core code, Visual Studio displays the source code. For example: Set a break point in OnGet in Pages/Privacy.cshtml.cs and select the Privacy link.


2 Answers

  1. Clone the repo(s) that you want for debugging from GitHub
  2. Add a global.json file to your solution, similar to the one here
  3. In the sources property, add the path(s) to the src folders that you got from github. For example:

    {
        "sources": [ "src", "D:\\dev\\aspnet\\mvc\\src" ]
    }
    
  4. Run and the sources in D:\dev\aspnet\mvc\src should be used instead of the NuGet packages from NuGet/MyGet.

PS: Make sure you are using the sources and the packages from the correct branch. Otherwise you might hit strange issues like the one described here

like image 159
Victor Hurdugaci Avatar answered Nov 05 '22 20:11

Victor Hurdugaci


As of beta4, the sources node in global.json has been changed to projects.

{
    "projects": [ "src", "D:\\dev\\aspnet\\mvc\\src" ]
}
like image 23
Eric Scott Avatar answered Nov 05 '22 18:11

Eric Scott