I use Visual Studio 2019 and a .NET Core 3 web application. I'd like to debug .NET Core source code, so when an error occurs I can dive into the code and examine it in more detail. As I couldn't find an exact description on how to do it (even on the Microsoft documentation site), I'll try to summarize here what I know so far.
I have the following options in Visual Studio:
- Enable just my code
- Enable .NET framework source stepping
- Enable source server support
- Enable source link support
The first two options are mutually exclusive. I suppose I should select the second option, although I don't understand weather ".NET framework" in this options includes .NET Core?
Now as .NET Core is open source and available on GitHub, I don't understand third vs. fourth option. The third should allow me to pull source from Microsoft Symbol Servers (do symbols include source?) while the fourth should allow me to pull source from GitHub? Do I need one or the other?
First, I put a breakpoint on CreateHostBuilder in the Main method, select the third option and run the application. After the breakpoint is hit, I keep stepping into code (F11) until a message appears saying "GenericHostBuilderExtensions.cs is not found". It offers me to browse for it, but I have no idea where could I find it.
Let's try all over again, this time selecting the fourth option (and deselection the third). Now, after the breakpoint is hit, Visual?Studio offers me to download the before mentioned file by Source Link. I accept, but the result is the message
Source Link Error: Azure DevOps: Authentication failed for all accounts. Use 'File -> Account Settings...' to add a new account or refresh credentials.
Well, I'm logged in with my Microsoft account. What else should I do?
I repeat it all again, this time selecting both third and fourth options. The result is the same.
Now I select another Source Link option: "Fall back to Git Credential manager..." and start all over again. The same result.
Of course, I extensively googled and spent quite some time trying to find a solution, but I'm missing something. I'd appreciate help on what exactly the mentioned options do and how to debug by stepping into .NET Core source code.
See Question&Answers more detail:
os