C# 调用堆栈中的“外部代码”是什么意思?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11629340/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-09 18:35:08  来源:igfitidea点击:

What does "external code" in the call stack mean?

c#.netvisual-studiodebugging

提问by Simon Kiely

I call a method in Visual Studio and attempt to debug it by going over the call stack.

我在 Visual Studio 中调用一个方法并尝试通过遍历调用堆栈来调试它。

Some of the rows in it are marked "External code".

其中的一些行被标记为“外部代码”。

What exactly does this mean? Methods from a .dll have been executed?

这到底是什么意思?来自 .dll 的方法已被执行?

Stupid question; but need a definitive answer.

愚蠢的问题; 但需要一个明确的答案。

采纳答案by Tigran

These are the lines where symbol informationis not currently available for Visual Studio Debugger. In other words Debuggeris not able to retrieve code from the line executed.

这些是符号信息当前不可用于 的行Visual Studio Debugger。换句话说Debugger,无法从执行的行中检索代码。

I wrote currentlybecause the symbol information can be downloaded or setup.

目前写的是因为符号信息可以下载或设置。

For more information you can read this : How to: Specify Symbol Locations and Loading Behavior

有关更多信息,您可以阅读:如何:指定符号位置和加载行为

回答by Polynomial

Those lines are not referenced by the debug symbols that you currently have loaded.

您当前已加载的调试符号未引用这些行。

This code may be part of an external DLL, or native code inside the CLR. If you know which module it is, and have debug symbols for them, you can load them into Visual Studio manually.

此代码可能是外部 DLL 的一部分,也可能是 CLR 内的本机代码。如果您知道它是哪个模块,并且有它们的调试符号,您可以手动将它们加载到 Visual Studio 中。

回答by Wolfgang Ziegler

Methods you do not have code / symbols for. Like .NET framework or 3rd party assemblies.

您没有代码/符号的方法。像 .NET 框架或 3rd 方程序集。

回答by Aghilas Yakoub

you can use the Attach to Process action on the Debug menu to debug running instance of your host app. (running process has the debug symbols .pdb files ).

您可以使用“调试”菜单上的“附加到进程”操作来调试正在运行的主机应用程序实例。(运行进程有调试符号 .pdb 文件)。

回答by marc wellman

The notation 'External Code' refers to everything that does not belong to 'My Code'.

符号“外部代码”指的是不属于“我的代码”的所有内容。

That's the way it is described in the MSDN documentation here How to: Use the Call Stack Window

这就是 MSDN 文档中描述的方式如何:使用调用堆栈窗口

In managed code, by default. the Call Stack window hides information for non-user code. > The following notation appears instead of the hidden information.

<[External Code]>

Non-user code is any code that is not "My Code."`

在托管代码中,默认情况下。调用堆栈窗口隐藏非用户代码的信息。> 出现以下符号而不是隐藏信息。

<[外部代码]>

非用户代码是任何不是“我的代码”的代码。`

Your Codeis as you might have thought everything you did write on your own. So with this definition everything that belongs to external dll's is omitted in the trace of the call stack.

Your Code就像您认为自己所做的一切一样。因此,使用此定义,在调用堆栈的跟踪中省略了属于外部 dll 的所有内容。

Furthermore according to How to: Step Into Just My Codeyou have the possibility to deny the debugger to try to trace non-user code.

此外,根据如何:单步执行我的代码,您可以拒绝调试器尝试跟踪非用户代码。

Here you will find the explanation for what user codeactually is:

在这里,您将找到user code实际情况的解释:

To distinguish user code from non-user code, Just My Code looks at three things: DBG Files, PDB files, and optimization.

为了区分用户代码和非用户代码,Just My Code 关注三件事:DBG 文件、PDB 文件和优化。

回答by Matas Vaitkevicius

[External code] means that there is no debugging information available for that dll.

[外部代码] 表示该 dll 没有可用的调试信息。

What you can do is in Call Stackwindow click right mouse button. Then select Show External Codethis will expand [External Code] and will show you modules that are being called.

您可以做的是在Call Stack窗口中单击鼠标右键。然后选择Show External Code这将展开 [External Code] 并显示正在调用的模块。

enter image description here

在此处输入图片说明

once you get it expanded you will see dll's that are being called you can get locations on disk by clicking on Symbol Load Information...

展开后,您将看到正在调用的 dll,您可以通过单击获取磁盘上的位置 Symbol Load Information...

enter image description here

在此处输入图片说明

This will open dialog that shows locations on disk

这将打开显示磁盘位置的对话框

enter image description here

在此处输入图片说明

If you want to debug these external files you need to get .pdbfiles for dll's and place in same folder as .dll

如果您想调试这些外部文件,您需要获取.pdbdll 文件并将其放置在与.dll

this should allow you to Load symbols(menu in screenshot 2 above Symbol Load Information) and start debugging.

这应该允许您Load symbols(上面截图 2 中的菜单Symbol Load Information)并开始调试。

More on getting .pdb files here.

更多关于在此处获取 .pdb 文件的信息。

And here's an actual example of EF .pdb being generated

这是生成 EF .pdb 的实际示例

Hope this saves you some time.

希望这可以为您节省一些时间。