Visual Studio 2008:调试托管代码时,到下一行的步骤非常缓慢

时间:2021-11-21 02:51:58

When stepping through my C# code line by line via F10, it takes the debugger over one second to get to the next line.

当通过F10逐行进入我的c#代码行时,调试器会在一秒钟内到达下一行。

I've tried deleting all watches and breakpoints, but that did not make any difference.

我试过删除所有的手表和断点,但是没有任何区别。

Is this normal? It's been like this for quite a long time now, so I can't even remember if this was ever better. My development computer is a Quad-core machine with no background task activity and plenty of RAM left.

这是正常的吗?这种情况已经持续了很长一段时间了,所以我都想不起来这是不是更好。我的开发计算机是一个四核机器,没有后台任务活动和大量的内存。

If it's not normal, what else could I try? It's still ok to work with, but a less sluggish user interface would be great...

如果不正常,我还能尝试什么?它仍然可以使用,但不那么迟缓的用户界面将是很好的……

9 个解决方案

#1


13  

What's likely happening is you have a variable in the call stack frame which has an expensive .ToString method. In 2008, the data for the call stack window is rebuilt on every step regardless of whether or not the window is actually visible. Part of building this window will call .ToString on the values which appear in the parameter list if they have an overridden .ToString. Try disabling implicit .ToString calls and see if that fixes the problem.

可能发生的情况是,在调用堆栈框架中有一个变量,它有一个昂贵的。tostring方法。在2008年,调用堆栈窗口的数据在每个步骤上重新构建,而不管窗口是否实际可见。构建此窗口的一部分将调用参数列表中出现的值的. tostring,如果这些值的. tostring被重写。尝试禁用隐式. tostring调用,看看这是否解决了问题。

  • Tools -> Options -> Debugger
  • 工具->选项->调试器
  • Uncheck the "Enable Implicit .ToString calls"
  • 取消“启用隐式.ToString调用”

#2


5  

I have found that if you have the option to debug unmanaged code turned on, the debugger can take a while to step between lines even if you are only debugging managed code. Try turning that option off (Project > Properties > Debug > Enable Debuggers > Enable unmanaged code debugging).

我发现,如果您有调试打开的非托管代码的选项,即使您只是调试托管代码,调试器也可以在两行之间进行一段时间的调试。尝试关闭该选项(项目>属性>调试>启用非托管代码调试)。

#3


4  

I tried all of the above. Unchecking 'Show Threads In Source' button fixed it.

以上我都试过了。不检查“显示线程在源代码”按钮修复它。

#4


3  

In my case, disabling "break all processes when one process breaks" (Tools/Options/Debugger) reduced the time to "step over" from 2-3 seconds to a fraction of a second.

在我的例子中,禁用“在一个进程中断时中断所有进程”(工具/选项/调试器)将“逐步结束”的时间从2-3秒减少到几分之一秒。

I have no idea why this option had such a big effect on doing a single step over. BTW, I suppose that disabling this option might cause trouble if you are using threads that are not independent from each other.

我不知道为什么这个选项对完成一个步骤有这么大的影响。顺便说一句,如果您使用的线程不是相互独立的,那么禁用这个选项可能会带来麻烦。

#5


1  

I once experienced slow debugging as I had set up VS to look for pdb files on a network share that didn't exist any more.

我曾经体验过缓慢的调试,因为我已经设置了VS来寻找网络共享中不再存在的pdb文件。

Check here : Tools - options - Debugging - Symbols - Symbol file (.pdb) Locations

检查这里:工具-选项-调试-符号-符号文件(.pdb)位置

#6


1  

I've heard of this kind of problem if the "Auto" window is open. Try closing that and see if your performance improves.

我听说过这种问题,如果“自动”窗口是打开的。尝试关闭它,看看你的表现是否有所改善。

If you haven't already, you should probably also install the "Visual Studio 2008 SP1 debugging and breakpoint" patch. Note that this patch goes on top of SP1. The docs for the patch don't specifically address the slowness that you're seeing, but it's a pretty large patch, and you might get lucky.

如果您还没有安装,您可能还应该安装“Visual Studio 2008 SP1调试和断点”补丁。注意,这个补丁位于SP1之上。这个补丁的文档并没有特别指出你所看到的缓慢,但是它是一个相当大的补丁,你可能会很幸运。

#7


1  

Turn off the Enable address-level debugging option in Tools > Options > Debugging > General.
It made a huge difference for me.

关闭工具>选项>中的Enable address级调试选项>通用调试。它给我带来了巨大的改变。

#8


0  

Do you have a lot of Watch expressions set up ? They will be evaluated after between each step, and if they take time to run, you will notice it as a delay when stepping.

你有很多手表的表达吗?它们将在每一步之间进行评估,如果它们需要时间运行,您会注意到它是一个延迟。

#9


0  

I was experiencing a 10 second delay after stopping C# debugging before being able to start C# debugging again. VS2008 would hang during this time with nothing clickable. There is now a 0 second delay after I disabled the Visual Studio hosting process in Project Properties -> Debug.

在停止c#调试之前,我经历了10秒的延迟。VS2008将在此期间挂起,没有点击。在我在项目属性> Debug中禁用Visual Studio托管过程之后,现在有一个0秒的延迟。

#1


13  

What's likely happening is you have a variable in the call stack frame which has an expensive .ToString method. In 2008, the data for the call stack window is rebuilt on every step regardless of whether or not the window is actually visible. Part of building this window will call .ToString on the values which appear in the parameter list if they have an overridden .ToString. Try disabling implicit .ToString calls and see if that fixes the problem.

可能发生的情况是,在调用堆栈框架中有一个变量,它有一个昂贵的。tostring方法。在2008年,调用堆栈窗口的数据在每个步骤上重新构建,而不管窗口是否实际可见。构建此窗口的一部分将调用参数列表中出现的值的. tostring,如果这些值的. tostring被重写。尝试禁用隐式. tostring调用,看看这是否解决了问题。

  • Tools -> Options -> Debugger
  • 工具->选项->调试器
  • Uncheck the "Enable Implicit .ToString calls"
  • 取消“启用隐式.ToString调用”

#2


5  

I have found that if you have the option to debug unmanaged code turned on, the debugger can take a while to step between lines even if you are only debugging managed code. Try turning that option off (Project > Properties > Debug > Enable Debuggers > Enable unmanaged code debugging).

我发现,如果您有调试打开的非托管代码的选项,即使您只是调试托管代码,调试器也可以在两行之间进行一段时间的调试。尝试关闭该选项(项目>属性>调试>启用非托管代码调试)。

#3


4  

I tried all of the above. Unchecking 'Show Threads In Source' button fixed it.

以上我都试过了。不检查“显示线程在源代码”按钮修复它。

#4


3  

In my case, disabling "break all processes when one process breaks" (Tools/Options/Debugger) reduced the time to "step over" from 2-3 seconds to a fraction of a second.

在我的例子中,禁用“在一个进程中断时中断所有进程”(工具/选项/调试器)将“逐步结束”的时间从2-3秒减少到几分之一秒。

I have no idea why this option had such a big effect on doing a single step over. BTW, I suppose that disabling this option might cause trouble if you are using threads that are not independent from each other.

我不知道为什么这个选项对完成一个步骤有这么大的影响。顺便说一句,如果您使用的线程不是相互独立的,那么禁用这个选项可能会带来麻烦。

#5


1  

I once experienced slow debugging as I had set up VS to look for pdb files on a network share that didn't exist any more.

我曾经体验过缓慢的调试,因为我已经设置了VS来寻找网络共享中不再存在的pdb文件。

Check here : Tools - options - Debugging - Symbols - Symbol file (.pdb) Locations

检查这里:工具-选项-调试-符号-符号文件(.pdb)位置

#6


1  

I've heard of this kind of problem if the "Auto" window is open. Try closing that and see if your performance improves.

我听说过这种问题,如果“自动”窗口是打开的。尝试关闭它,看看你的表现是否有所改善。

If you haven't already, you should probably also install the "Visual Studio 2008 SP1 debugging and breakpoint" patch. Note that this patch goes on top of SP1. The docs for the patch don't specifically address the slowness that you're seeing, but it's a pretty large patch, and you might get lucky.

如果您还没有安装,您可能还应该安装“Visual Studio 2008 SP1调试和断点”补丁。注意,这个补丁位于SP1之上。这个补丁的文档并没有特别指出你所看到的缓慢,但是它是一个相当大的补丁,你可能会很幸运。

#7


1  

Turn off the Enable address-level debugging option in Tools > Options > Debugging > General.
It made a huge difference for me.

关闭工具>选项>中的Enable address级调试选项>通用调试。它给我带来了巨大的改变。

#8


0  

Do you have a lot of Watch expressions set up ? They will be evaluated after between each step, and if they take time to run, you will notice it as a delay when stepping.

你有很多手表的表达吗?它们将在每一步之间进行评估,如果它们需要时间运行,您会注意到它是一个延迟。

#9


0  

I was experiencing a 10 second delay after stopping C# debugging before being able to start C# debugging again. VS2008 would hang during this time with nothing clickable. There is now a 0 second delay after I disabled the Visual Studio hosting process in Project Properties -> Debug.

在停止c#调试之前,我经历了10秒的延迟。VS2008将在此期间挂起,没有点击。在我在项目属性> Debug中禁用Visual Studio托管过程之后,现在有一个0秒的延迟。