调试 System.Threading [英] Debugging System.Threading

查看:26
本文介绍了调试 System.Threading的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以调试 System.Threading 库?

Is it possible to debug System.Threading library?

我有一个看起来像这样的堆栈跟踪:

I have a stack trace that looks somewhat like this:

我已按照我能看到的有关如何调试 .NET 库的所有步骤进行操作.

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

  • 取消选中仅启用我的代码"
  • 选中启用 .NET Framework 源步进"
  • 选中启用源服务器支持"
  • 选中符号文件 (.pdb) 位置下的Microsoft 符号服务器"

然而,当我尝试调试 System.threadin 调用时,我得到一个文件未找到页面,要求我浏览并查找 .cs 文件.

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.

类似的东西.

是否可以调试 System.Threading 库?我是否遗漏了任何步骤?

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

我不确定它是否重复.例如,另一个线程上的顶级解决方案要求我访问甚至不包含 System.Threading 的 referencesource.microsoft.com.这是一个专门针对该图书馆的问题.如果不出意外,对此的有效答案可能是无法调试 System.Threadin",或者可以但使用其他方法进行调试

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

推荐答案

正常场景:

我们可以尝试升级到最新的 .net 4.8 框架,它适用于这两个类似问题的某些情况 如何调试 System.Web.dll?无法进入演示框架.

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.

因为我们应该确保 https://referencesource.microsoft.com/ 包含我们的确切版本重新调试,大多数时候选择最新版本比较好.

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.

但是对于这个:

因为升级到 .net 4.8 似乎没有解决这个问题(也许我在这个过程中做错了什么?).我选择了另一个方向(使用本地源)但它在我身边工作.

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.

当我们在调试.net框架源代码时,除了源服务器之外,它还会尝试在本地目录中查找源代码.因此,我们可以在我们的机器中下载源代码 .zip 文件并配置解决方案的源文件设置.

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/然后点击右上角的下载按钮

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

2.将 .NET Framework 的整个源代码下载为 .zip 文件.由于我的项目面向 .net framework 4.8,所以我下载了 .net 4.8 包.

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.解压缩包含源代码的 .zip 文件并将其移动到我决定保留源代码的位置,然后在 VS IDE=>右键单击解决方案 => 属性 =>Common Properties => Debug Source Files => New Line(Ctrl-Insert) 并输入Source文件夹的路径(解压文件夹中的Source文件夹)=>Apply=>好的.

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.

对我来说,我将解压后的 DotNet48RTM 文件夹放在 Documents 文件夹中,所以我在 Debug Source Files 设置中输入的路径是 C:\Users\xxx\Documents\DotNet48RTM\Source

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

然后我可以在运行重建后进入 System.Threading 库.

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

此外:确保您已满足此处.您应该在Debug=>Options=>Symbols 中禁用要求源文件与原始版本完全匹配 选项和清空符号缓存.

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.

这篇关于调试 System.Threading的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆