visual-studio 如何防止 Visual Studio 调试器可视化器超时?

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

How to keep Visual Studio debugger visualizers from timing out?

visual-studiodebuggingdebuggervisualizer

提问by yoyoyoyosef

I've successfully made several Visual Studio debugger visualizers, and they're working very well, except that on some objects I get a time out error when I try to deserialize the object with objectProvider.GetObject()

我已经成功地制作了几个 Visual Studio 调试器可视化器,它们运行良好,除了在某些对象上我尝试反序列化对象时出现超时错误 objectProvider.GetObject()

System.Exception: Function evaluation timed out.
  at Microsoft.VisualStudio.DebuggerVisualizers.DebugViewerShim.PrivateCallback.MaybeDeserializeAndThrowException(Byte[] data)

The time out happens rather quickly (maybe about a second after I click on the visualizer icon), even though some of my other visualizers work fine even with large data objects that much longer to display (5-10 seconds) and still don't timeout.

超时发生得相当快(可能在我单击可视化器图标后大约一秒钟),即使我的其他一些可视化器工作正常,即使大数据对象的显示时间要长得多(5-10 秒),但仍然没有暂停。

I've already made a custom object source to limit the serialization to the fields I need to display. What else can I do to get the data to deserialize without timing out?

我已经制作了一个自定义对象源来限制序列化到我需要显示的字段。我还能做些什么来使数据反序列化而不超时?

回答by Ying

HKEY_CURRENT_USER\Software\Microsoft\VisualStudio.0\Debugger

I think this is not documented, but you can try changing some of the Timeouts in the above registry key, and restart Visual Studio.

我认为这没有记录,但您可以尝试更改上述注册表项中的一些超时,然后重新启动 Visual Studio。

回答by ldam

I was recently hit by this in VS2012 and after googling I found this:

我最近在 VS2012 中遇到了这个问题,在谷歌搜索后我发现了这个

As the exception message says, this exception means the debugger visualizer for the datatable is timed out. In VS debugger, each expression evaluation windows(such as watch window, locals window, datatips, autos window etc..) has different default max expression evaluation timed out value. For datatip, we prefer to give a short time out value because otherwise it will provide a poor user expression. If you do want to use the visualizer functionality for that datatable, you may add the expression to a watch and try to visualize it.(Because watch window has a longer timeout value). If you do want to get rid of this timeout in datatip, you may try to increase the timeout value for datatip. The timeout value is a setting in "DataTipTimeout" registry key under: HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\Debugger Note: you should probe WOW64Node for 64bit OS. You can also see other windows' default timeout value under this key.

正如异常消息所说,此异常意味着数据表的调试器可视化器超时。在 VS 调试器中,每个表达式评估窗口(例如观察窗口、本地窗口、数据提示、自动窗口等)都有不同的默认最大表达式评估超时值。对于数据提示,我们更愿意给出一个短的超时值,否则它会提供一个糟糕的用户表达。如果您确实想对该数据表使用可视化器功能,您可以将表达式添加到监视中并尝试对其进行可视化。(因为监视窗口具有更长的超时值)。如果您确实想摆脱 datatip 中的超时,您可以尝试增加 datatip 的超时值。超时值是“DataTipTimeout”注册表项中的设置:HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10。0\Debugger 注意:对于 64 位操作系统,您应该探测 WOW64Node。您还可以在此键下查看其他窗口的默认超时值。

回答by ARS one -

To Visual Studio debugger work well - "Locals" window in "WPF visualizer" (tested in WPF application), you need to find in registry: HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0\Debugger\ DWORD parameter "LocalsTimeout" and default value (1000) set to big enough value, 5000, for example.

为了使 Visual Studio 调试器运行良好 - “WPF 可视化器”中的“Locals”窗口(在 WPF 应用程序中测试),您需要在注册表中找到:HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0\Debugger\DWORD 参数“LocalsTimeout”和默认值(1000) 设置为足够大的值,例如 5000。