5

Yes, I know that this question arises from time to time, I have searched for answer on internet, but nothing seems to work right. So I prepared I detailed explanation, accompanied by screenshots, on what I tried to do to be able to follow code execution throught .NET Core source code and what was the result.

I'm using Visual Studio Community 16.8.3, and have created a .NET Core 3.1 web app from template. I changed the code in Startup class to make it crash.

enter image description here

These are my debug settings (I have no idea weather .NET Framework source stepping has any significance for .NET Core projects):

enter image description here

So lets run and hit an exception:

enter image description here

Here I'll choose just to decomplie the source code (there's a link for it on the previous image), to see if this works:

enter image description here

OK, but I just see the code, can't examine variable and object values. Let's rerun and see if I can get the code by clicking on the symbol server when the exception hits:

enter image description here

It complains, so let's enable source servers.

enter image description here

Lets run it again, and hit the exception.

enter image description here

Now it complains on some kind of exclusion (see symbol status column):

enter image description here

I load all the symbold manually:

enter image description here

Here I rerun the app, with all the symbols loaded, but when the exception hits I still can't F11 into the .NET Core source:

enter image description here

What am I missing to be able to step throught the .NET Core source code?

3
  • "Enable .Net Framework source stepping"? Commented Dec 28, 2020 at 14:46
  • I'm using .NET Core, not .NET Framework. Anyway, I tried that option too, but everything stays the same. Commented Dec 28, 2020 at 18:58
  • This shows you how to debug ASP.NET Core source code: levelup.gitconnected.com/… Commented Nov 11, 2021 at 3:44

2 Answers 2

4
+150

Did you enable Source Link? I was able to step into the .NET Core 3.1 source code after doing the following:

  • Uncheck "Enable Just My Code" and check "Enable Source Link support" in Tools -> Options -> Debugging -> General enter image description here

  • Activate the symbol servers in Tools -> Options -> Debugging -> Symbols enter image description here

I got this information from Improving Debug-time Productivity with Source Link on Microsoft Devblogs.

Sign up to request clarification or add additional context in comments.

Comments

2

The exception says that public method Configure is missing in Startup class. The application did not start properly and that is why debugging does not work.

2 Comments

The application hit an exception in the .NET Core source sode. I want to see the point where the exception was hit, to examine the context in which it happened. I myself created the situation where the exception would arise, this is just a simplified example of a situation which might arise in a real system.
You can step into .NET Core source code by enabling Source Link support (I added an answer to describe it in more detail).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.