visual-studio Visual Studio 中的缓慢调试问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/589338/
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-10-22 10:13:00  来源:igfitidea点击:

Slow debugging issue in Visual Studio

visual-studiodebuggingvisual-studio-2008performance

提问by George2

In my Visual Studio instance, even if I just wrote a single line of return in a C# console application, it will take me a minute after pressing F5to execute the actual code (I mean the time it takes to stop on the single return statement after pressing F5-- I set a breakpoint on the return statement in the mainfunction). What is wrong? Is there a check list?

在我的 Visual Studio 实例中,即使我只是在 C# 控制台应用程序中写了一行 return,按下F5执行实际代码后我也需要一分钟(我的意思是在单个 return 语句之后停止所需的时间按下F5——我在main函数的 return 语句上设置了一个断点)。怎么了?有检查清单吗?

I am using Visual Studio 2008 VSTS edition and debugging on Windows Server 2003 x64.

我在 Windows Server 2003 x64 上使用 Visual Studio 2008 VSTS 版本和调试。

回答by zweiterlinde

You may need to delete all your breakpoints---note that you need to click the "Delete all breakpoints" button (or use Ctrl+ Shift+ F9), NOTjust delete them one by one. If Visual Studio has mangled your solution settings the latter will not work. You may need to add a breakpoint first, in order for this to work (clever, eh?).

你需要点击“删除所有断点”按钮(或使用您可能需要删除所有的断点---记Ctrl+ Shift+ F9),只是删除它们一个接一个。如果 Visual Studio 损坏了您的解决方案设置,后者将不起作用。您可能需要先添加一个断点,以使其工作(聪明,嗯?)。

If worst comes to worst, you may need to delete your .suofile and let Visual Studio start a new one from scratch. Note that you will lose your personal solution configuration settings, however (only for this solution, not any others). However, you may want to move/rename the file temporarily until you determine whether or not this is the problem; that way, you can always move it back. I have seen some online resources recommend deleting (moving/renaming) the .ncbfile as well.

如果最坏的情况出现,您可能需要删除您的.suo文件并让 Visual Studio 从头开始​​创建一个新文件。请注意,您将丢失您的个人解决方案配置设置(仅针对此解决方案,不适用于任何其他解决方案)。但是,您可能希望暂时移动/重命名文件,直到您确定这是否是问题所在;这样,您可以随时将其移回。我已经看到一些在线资源也建议删除(移动/重命名).ncb文件。

回答by m-sharp

I have seen this before. Try deleting allyour breakpoints and then set the ones you want. Hit F5. Is it faster now?

我以前见过这个。尝试删除所有断点,然后设置所需的断点。击中F5。现在是不是更快了?

I just noticed that you mentioned setting up the .NET source debugging feature. Try to disable that. Your network connectivity to Microsoft's source server may be slow. Also disable any symbol server connectivity in menu ToolsOptionsDebuggingSymbols.

我刚刚注意到您提到设置 .NET 源代码调试功能。尝试禁用它。您与 Microsoft 源服务器的网络连接可能很慢。还可以在菜单ToolsOptionsDebuggingSymbols 中禁用任何符号服务器连接。

Also try disabling "Enable property evaluation and other implicit function calls" in menu ToolsOptionsDebuggingGeneral.

还可以尝试在菜单ToolsOptionsDebuggingGeneral 中禁用“启用属性评估和其他隐式函数调用” 。

回答by Frank

Or remove your .suo file which can be found next to your solution (.sln) file. This solved an issue I had with debug sessions taking a long time to start and stop.

或者删除您的解决方案 (.sln) 文件旁边的 .suo 文件。这解决了我在调试会话需要很长时间才能启动和停止时遇到的问题。

回答by Kevin DiTraglia

I had this problem. After trying all the listed advice and removing all Visual Studio extensions, we finally figured out that somehow IntelliTrace was enabled. Disabling that fixed everything.

我有这个问题。在尝试了所有列出的建议并删除了所有 Visual Studio 扩展之后,我们终于发现以某种方式启用了 IntelliTrace。禁用它修复了一切。

How to: Enable and Disable IntelliTrace

如何:启用和禁用 IntelliTrace

回答by mafu

My colleague had a very slowly responding Visual Studio, and it literally took minutes to perform a step while debugging.

我的同事有一个响应非常缓慢的 Visual Studio,在调试时执行一个步骤确实需要几分钟时间。

The root cause turned out to be an anti virus program(Threatfire) that went crazy while Visual Studio was running. Killing its process immediately fixed everything.

结果证明,根本原因是一个反病毒程序(Threatfire) 在 Visual Studio 运行时变得疯狂。杀死它的进程立即修复了一切。

回答by 1800 INFORMATION

Do you have a lot of breakpoints set? Those can really slow down startup time. Everytime a new module is loaded into the process address space, they all need to be checked to see if they are valid.

你设置了很多断点吗?这些真的会减慢启动时间。每次将新模块加载到进程地址空间时,都需要检查它们是否有效。

回答by Steve Steiner

Go to menu ToolsOptionsDebuggerSymbolsand check if you have public symbols set or UNCnetwork paths set. Also check menu Tools* → OptionsDebuggerGeneralto see if you have source server set.

转到菜单工具选项调试器符号并检查您是否设置了公共符号或UNC网络路径。还要检查菜单工具* →选项调试器常规以查看您是否设置了源服务器。

All of these can affect debugging based on slow network speed or unavailable servers. The 5 minute wait time is network timeouts.

所有这些都会影响基于网络速度慢或服务器不可用的调试。5 分钟的等待时间是网络超时。

If nothing in options is set, check to see if you have the _NT_SYMBOL_PATH environment variable set.

如果选项中未设置任何内容,请检查您是否设置了 _NT_SYMBOL_PATH 环境变量。

回答by cahit beyaz

In my case changing the debug symbol "Automatically load symbol for"option from "All modules" to "Only specified modules" solved the problem. You can change this option from menu ToolsOptionsDebuggingSymbols.

在我的情况下,将调试符号“自动加载符号”选项从“所有模块”更改为“仅指定模块”解决了问题。您可以从菜单ToolsOptionsDebuggingSymbols更改此选项。

回答by marcelloptr

A different cause plus... How to find the problem

一个不同的原因加上...如何找到问题

To me it was the option ShowOtherThreadIpMarkers. A value of 1 makes Visual Studio (2010) unbearably slow (3-5 seconds for each debug step. With a value of 0, it is fast again.

对我来说是ShowOtherThreadIpMarkers选项。值为 1 会使 Visual Studio (2010) 慢得难以忍受(每个调试步骤 3-5 秒。值为 0 时,它又快了。

What is it that option? I have no idea. I could not find it through the Visual Studio user interface. I unchecked all possible debugging options in there and nothing worked.

那个选项是什么?我不知道。我无法通过 Visual Studio 用户界面找到它。我在那里取消了所有可能的调试选项,但没有任何效果。

So I went to Import/ExportSettings and loaded my old settings I've previously saved going backward in time until Visual Studio was fast again, then compared the vssettings files..., etc., etc.

因此,我转到“导入/导出设置”并加载我之前保存的旧设置,然后及时向后移动,直到 Visual Studio 再次快速运行,然后比较 vssettings 文件……等等。

I'd like to remark that if you load the settings while you are in debug mode stopped on a breakpoint, they become effective immediately. You don't have to stop the debugger and restart.

我想说的是,如果您在调试模式下加载设置并在断点处停止,它们会立即生效。您不必停止调试器并重新启动。

回答by Ben Hughes

Running under the debugger for me was roughly 10x slower than running without debugging.

对我来说,在调试器下运行比在没有调试的情况下运行大约慢 10 倍。

After trying every solution suggested here, I went through every debugger setting and enabled/disabled to see if it made a difference.

在尝试了这里建议的每个解决方案后,我检查了每个调试器设置并启用/禁用以查看它是否有所作为。

For me, it turned out that disabling Suppress JIT optimization on module loadin the debug settings massivelyimproved things.

对我来说,事实证明在调试设置中禁用对模块加载的抑制 JIT 优化大大改善了事情。