简体   繁体   中英

Debugging System.Threading

Is it possible to debug System.Threading library?

I have a stack trace that looks somewhat like this:

在此处输入图片说明

I have followed all the steps I could see on how to debug .NET libraries.

  • Uncheck 'Enable Just My Code'
  • Check 'Enable .NET Framework source stepping'
  • Check 'Enable Source Sever Support'
  • Check 'Microsoft Symbol Servers' under Symbol file (.pdb) locations

And yet when I try to debug a System.threadin call, I get a file not found page that asks me to Browse and Find the .cs file.

Something like this. 在此处输入图片说明

Is it possible to debug System.Threading library? Am I missing any steps?

Edit: I am not sure its a duplicate. For example, the top solution on the other thread asks me to go to referencesource.microsoft.com which does not even contain System.Threading. This is a question specifically for that library. If nothing else, a valid answer for this might be 'It is not possible to debug System.Threadin' or it is possible but use some other method to do so

Normal scenario:

We can try upgrading to newest .net 4.8 framework, it works for some situations like these two similar issues How to debug System.Web.dll? and Unable to step into PresentationFramework .

Cause we should ensure https://referencesource.microsoft.com/ contains the exact version we're debugging, most of the time it's better to choose the latest version.

But for this one:

Since upgrading to .net 4.8 seems to not resolve this issue(Maybe something I did wrong in the process?).I choose another direction( using local source ) but it works in my side.

When we're debugging the .net framework source code, apart from the source server, it will also try to find the source in local directory. So we can download the source code .zip file in our machine and configure the Source File settings for solution .

1 .Go https://referencesource.microsoft.com/ and click the Download button in the upper right corner

2 .Download the entire source code of .NET Framework as a .zip file. Since my project targets .net framework 4.8 , so I download the .net 4.8 package .

(We only need to download the appropriate package corresponding to our project, no need to download all of them)

3 .Unzip the .zip file which contains source code and move it to an Location I decide to keep the source code, then in VS IDE=>Right-click solution => Properties => Common Properties => Debug Source Files => New Line(Ctrl-Insert) and enter the path of the Source folder(The Source folder in unzipped folder)=>Apply=>OK.

For me, I put the unzipped DotNet48RTM folder in Documents folder, so the path I enter in the Debug Source Files setting is C:\\Users\\xxx\\Documents\\DotNet48RTM\\Source

Then I can step into the System.Threading library after I run a rebuild.

In addition: Make sure you've met all requirements mentioned here . You should disable require source files to exactly match the original version option and Empty the symbol cache in Debug=>Options=>Symbols .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM