I use Visual Studio 2019 and .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 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 3rd vs 4th option. The 3rd should allow me to pull source from Microsoft Symbol Servers (do symbols include source?) while the 4th should allow me to pull source from GitHub? Do I need one or the other?
First, I put a breakpoint on CreateHostBuilder in Main method, select the 3rd 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 4th option (and deselection the 3rd). Now, after the breakpoint is hit, VS offers me to download the before mentioned file by Source Link. A 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 3rd and 4th options. Result is the same.
Now I select another Source Link option: "Fall back to Git Credential manager..." and start all over again. 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.