这个问题由来已久,却一直没有找到原因。大家都知道,VisualStudio的DebuggerVisualizers是一个非常方便的插件,可以帮助我们调试时查看Datatable视图,前阵子突然发现在查看时报错了,截图 如下:

  详细信息里的内容是:

  有关调用实时(JIT)调试而不是此对话框的详细信息,
请参见此消息的结尾。 ************** 异常文本 **************
System.Exception: 函数计算超时。
在 Microsoft.VisualStudio.DebuggerVisualizers.DebugViewerShim.PrivateCallback.MaybeDeserializeAndThrowException(Byte[] data)
在 Microsoft.VisualStudio.DebuggerVisualizers.DebugViewerShim.ManagedShim.DelegatedHost.CreateViewer(IntPtr hwnd, HostServicesHelper hsh, SafeProxyWrapper proxy) ************** 已加载的程序集 **************
mscorlib
程序集版本:4.0.0.0
Win32 版本:4.0.30319.18444 built by: FX451RTMGDR
基本代码:file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
Microsoft.VisualStudio.Platform.AppDomainManager
程序集版本:12.0.0.0
Win32 版本:12.0.21005.1
基本代码:file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualStudio.Platform.AppDomainManager/v4.0_12.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Platform.AppDomainManager.dll
----------------------------------------
System
程序集版本:4.0.0.0
Win32 版本:4.0.30319.18408 built by: FX451RTMGREL
基本代码:file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Configuration
程序集版本:4.0.0.0
Win32 版本:4.0.30319.18408 built by: FX451RTMGREL
基本代码:file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
程序集版本:4.0.0.0
Win32 版本:4.0.30319.34234 built by: FX452RTMGDR
基本代码:file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Windows.Forms
程序集版本:4.0.0.0
Win32 版本:4.0.30319.18408 built by: FX451RTMGREL
基本代码:file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
程序集版本:4.0.0.0
Win32 版本:4.0.30319.18408 built by: FX451RTMGREL
基本代码:file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
Microsoft.VisualStudio.DebuggerVisualizers
程序集版本:12.0.0.0
Win32 版本:12.0.21005.1
基本代码:file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualStudio.DebuggerVisualizers/12.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.DebuggerVisualizers.dll
----------------------------------------
System.Windows.Forms.resources
程序集版本:4.0.0.0
Win32 版本:4.0.30319.18408 built by: FX451RTMGREL
基本代码:file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms.resources/v4.0_4.0.0.0_zh-Hans_b77a5c561934e089/System.Windows.Forms.resources.dll
---------------------------------------- ************** JIT 调试 **************
要启用实时(JIT)调试,
该应用程序或计算机的 .config 文件(machine.config)的 system.windows.forms 节中必须设置
jitDebugging 值。
编译应用程序时还必须启用
调试。 例如: <configuration>
<system.windows.forms jitDebugging="true" />
</configuration> 启用 JIT 调试后,任何未经处理的异常
都将被发送到在此计算机上注册的 JIT 调试器,
而不是由此对话框处理。

  从这个错误内容来看,最后抛出的是行6和行7,这是IDE绘制查看器弹窗时抛出的异常,我找了下这个dll,还真找到了,具体位置在

Common7\IDE\ReferenceAssemblies\v2.\Microsoft.VisualStudio.DebuggerVisualizers.dll

  当然,VS真正调的应该不是这个位置,从错误行49可以看出(实际上把这个位置的DebuggerVisualizers.dll删除照样可以使用),是调的Windows下面的某个位置,这可能是写到注册表里或者环境变量里了,反正是这个dll不错,但是vs使用的位置我没法查到。用Reflector反编译之,行7的CreateViewer源码如下:

  [ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine), ResourceExposure(ResourceScope.None)]
internal void CreateViewer(IntPtr hwnd, ManagedShim.HostServicesHelper hsh, ManagedShim.SafeProxyWrapper proxy)
{
try
{
byte[] data = proxy.InitSourceDataProvider();
using (AssemblyResolver resolver = new HostResolver(proxy, hsh.IsRemote, new ServiceProvider.WindowWrapper(hwnd)))
{
string str;
string str2;
int num;
ASSEMBLYLOCRESOLUTION assemblylocresolution;
byte[] buffer;
byte[] buffer2;
PrivateCallback.MaybeDeserializeAndThrowException(data);
proxy.GetManagedViewerCreationData(out str, out buffer, out buffer2, out str2, out assemblylocresolution, out num);
if ((assemblylocresolution == ASSEMBLYLOCRESOLUTION.ALR_ERROR) && (str != null))
{
throw new TerminalException(str, MessageBoxIcon.Hand);
}
if (((buffer != null) && (str == null)) && (hsh.IsRemote && !QueryRemoteLoadAllowed(null, new ServiceProvider.WindowWrapper(hwnd))))
{
throw new TerminalException(MessageBoxIcon.Hand);
}
ClassAndAssemblySpec spec = new ClassAndAssemblySpec(str, buffer, assemblylocresolution != ASSEMBLYLOCRESOLUTION.ALR_NAME, str2);
DialogDebuggerVisualizer visualizer = (DialogDebuggerVisualizer) spec.CreateInstance(resolver);
using (PrivateCallback callback = new PrivateCallback(proxy, num != ))
{
visualizer.Show(new ServiceProvider(hwnd, hsh).DialogService, callback);
}
}
}
catch (TerminalException exception)
{
exception.DisplayDialog(new ServiceProvider.WindowWrapper(hwnd));
}
catch (Exception exception2)
{
new ThreadExceptionDialog(exception2).ShowDialog(new ServiceProvider.WindowWrapper(hwnd));
}
}

  从上面可以看出,走到行15就执行了异常处理,然后由PrivateCallback的MaybeDeserializeAndThrowException方法接管过来,MaybeDeserializeAndThrowException源码如下:

  internal static unsafe byte[] MaybeDeserializeAndThrowException(byte[] data)
{
if ((data == null) || (data.Length == ))
{
return null;
}
DebugeeHost.DataPrefix prefix = (DebugeeHost.DataPrefix) data[];
switch (prefix)
{
case DebugeeHost.DataPrefix.Exception:
{
Exception exception = (Exception) DeserializeObject(data, );
throw exception;
}
case DebugeeHost.DataPrefix.ObjectData:
return data; case DebugeeHost.DataPrefix.CustomExceptionData:
{
DebugeeHost.CustomExceptionDataHolder cedh = (DebugeeHost.CustomExceptionDataHolder) DeserializeObject(data, );
throw new RemoteObjectSourceException(cedh);
}
case DebugeeHost.DataPrefix.ErrorString:
case DebugeeHost.DataPrefix.ErrorStringNoHost:
if (data.Length < )
{
throw new ApplicationException(SR.GetString("E_G_InvalidSerializationFormat"));
}
break; default:
return data;
}
fixed (byte* numRef = data)
{
int length = numRef[];
if ((data.Length - ) < (length * ))
{
throw new ApplicationException(SR.GetString("E_G_InvalidSerializationFormat"));
}
char* chPtr = (char*) (numRef + );
string message = new string(chPtr, , length);
if (prefix == DebugeeHost.DataPrefix.ErrorStringNoHost)
{
throw new TerminalException(message, MessageBoxIcon.Exclamation);
}
throw new Exception(message);
}
}

  这里应该就是最后的“事发现场了”,其中case的枚举如下:

 internal enum DataPrefix : byte
{
CustomExceptionData = ,
ErrorString = ,
ErrorStringNoHost = ,
Exception = ,
ObjectData =
}

  到此好像没法追踪下去了,它是通过传入的byte[]的0位值来抛出相应的异常,只有值为2或者default的时候才不抛出,由于没法模拟环境,即使我给了传入byte[],那么里面的调用层次还是要经过一番考究的。为此我也考虑了其他因素:

  1. 系统

  2. 硬件

  3. 内存

  4. 杀毒软件

  5. IDE本身

  6. 软件冲突

  7. 补丁

  8. IDE配置

  现在的现象是时好时坏,那么2、7就可以排除了,找了另外一台电脑,同样的系统同样的vs版本可以查看,那么1和5可以排除,内存用360释放一样有错,3可以排除,杀毒软件退掉依旧,4可以排除,6的话就麻烦了,难以查证,8的话也对比了正常的配置,没有差异,也可排除。

  现在比较有效的办法有两个:

  1、清理项目或者清理解决方案;

  2、杀进程,在任务管理器里结束与vs项目相关的host进程(不包括devenv.exe),如果有MSBuildTaskHost也要结束,然后再启动新实例,一般都能正常查看。

VS2010Datatable查看器查看超时(Microsoft.VisualStudio.DebuggerVisualizers)的更多相关文章

  1. 自定义可视化调试工具(Microsoft.VisualStudio.DebuggerVisualizers)

    前言: 最近飞机失联的太多,明天要飞北京处理服务器双机热备的问题,航空保险已买,单号是:TF10122913. 至于我的银行卡密码,在我枕头下面的字条里,要是我之后没再更新文章,请通知我家人,哈哈哈哈 ...

  2. 自定义可视化调试工具(Microsoft.VisualStudio.DebuggerVisualizers)vs.net开发工具

    背景: 话说:使用CYQ.Data时,会经常断点MDataTable的对象,为了查看表格的数据内容,在监视里会常ToDataTable(),然后借可DataTable的可视化方式查看表格. 近日:心中 ...

  3. WINDOWS SERVER 2016 设置使用照片查看器查看图片

    1.使用win+R快捷键快速打开运行,输入regedit打开注册表 2.在注册表中找到HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Photo Viewe ...

  4. Microsoft.VisualStudio.DebuggerVisualizers.dll 文件位置 for VisualStudio 2015

    可视化调试工具(Microsoft.VisualStudio.DebuggerVisualizers) "C:\Program Files (x86)\Microsoft Visual St ...

  5. win10使用照片查看器查看图片

    1.关于 演示环境: win10 1909 2.习惯win7的照片查看器 如果你习惯使用win7的照片查看器在win10查看照片,可以通过下面的注册表代码实现.方法:1.创建 后缀名为 .reg的文件 ...

  6. Win10系统怎样让打开图片方式为照片查看器

    转载自:百度经验 http://jingyan.baidu.com/article/5d368d1ef0cad13f60c057e3.html 1.首先,我们需要使用注册表编辑器来开启Win10系统照 ...

  7. OLE/COM 对象查看器 & OLE常用术语

    "OLE/COM Object Viewer"(OLE/COM 对象查看器)查看你系统上安装的所有 COM 对象时,是一个非常便利的工具. 它是 Windows 2000 资源套件 ...

  8. win10图片打开方式里没有默认照片查看器的解决方法

    今天安装好win10后发现打开图片的默认程序是win10自带的画图工具,非常不方便,并且右键选择打开方式里边也找不到默认的“照片查看器”.百度搜索了一下关于win10打开方式恢复默认照片查看器的方法, ...

  9. WIN10把照片查看器设为默认看图软件

    WIN10默认是PHOTO,没有以前WIN7的照片查看器好用,要改回来的方法如下:   在注册表HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Photo ...

随机推荐

  1. 介绍一个很好用的Rsa加解密的.Net库 Kalix.ApiCrypto

    Rsa非对称加密技术 这个就不说了,大家上网搜索都知道,公钥加密,私钥解密.当然大家也可以自己实现.这里就懒了,就去找一个现成的库,Nuget上搜索,GitHub上搜索,发现.Net的加解密库,下载量 ...

  2. JFrame 布局

    引用文章:https://blog.csdn.net/zyj0813/article/details/78309739

  3. LeetCode Valid Anagram (简单题)

    题意: 给出两个字符串s和t,判断串t是否为s打乱后的串. 思路: 如果返回的是true,则两个串的长度必定相等,所有字符出现的次数一样.那么可以统计26个字母的次数来解决,复杂度O(n).也可以排序 ...

  4. Windows 服务快捷启动命令,可以直接在运行处运行电脑的功能。

    gpedit.msc-----组策略 sndrec32-----录音机 nslookup----- ip地址侦测器 explorer------ 打开资源管理器 logoff-------注销命令 t ...

  5. DOM编程艺术-setTimeout,"moveElement('"+elementID+"',"+final_x+","+final_y+","+interval+")"

    DOM编程艺术一个小demo,看到这里的时候不理解 "moveElement('"+elementID+"',"+final_x+","+f ...

  6. 部署git服务器(Windows Server 2008)

    原来的这个项目是一个人开发的,没有做版本管理,我接手后准备搭建git版本管理服务端,方便离线开发和做版本管理: 一台云主机,操作系统:Windows Server 2008,64位: java已经安装 ...

  7. 转载请注明:Windows 系统必备好用软件&工具合集跟推荐 | 老D博客

    Windows 系统必备好用软件&工具合集跟推荐 97 63,371 A+ 所属分类:工具软件 一.浏览器 二.下载软件 三.播放软件 五.电子邮件客户端 六.图片/照片 浏览查看工具 七.文 ...

  8. 【转】IOS基础:深入理解Objective-c中@class的含义

    objective-c中,当一个类使用到另一个类时,并且在类的头文件中需要创建被引用的指针时, 如下面代码: A.h文件 #import "B.h" @interface A :  ...

  9. 2018.2.6 JS-判断用户浏览器

    JS-判断用户浏览器 在判断用户使用的浏览器是否为PC还是移动设备,有时候项目中需要用到.可在需要的项目中当全局方法来使用. 判断代码 function getMoblieDevice(window) ...

  10. 使用ASP.NET Web API和Web API Client Gen使Angular 2应用程序的开发更加高效

    本文介绍“ 为ASP.NET Web API生成TypeScript客户端API ”,重点介绍Angular 2+代码示例和各自的SDLC.如果您正在开发.NET Core Web API后端,则可能 ...