这个问题由来已久,却一直没有找到原因。大家都知道,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. linux解压与参数介绍

    linux下 各种解压文件使用方法:https://www.jianshu.com/p/ca41f32420d6 解压参数详解:http://www.cnblogs.com/jyaray/archiv ...

  2. lambda匿名函数,sorted排序,filter()筛选,map()映射

    一丶匿名函数 语法: 函数名 = lambda参数:返回值 # 普通的正常的函数 def func(n): return n * n ret = func(9) print(ret) # 匿名函数 a ...

  3. Caused by: java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.<init>(I)V

    项目中各种缺包现象... Caused by: java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.<init>(I)V ...

  4. mathtype 章节号 Equation Chapter 1 Section 1 的去除

    mathtype 章节号 Equation Chapter 1 Section 1 的去除 转:http://hi.baidu.com/17ximm/blog/item/2882413e92fc96c ...

  5. Angular ui-route介绍

    参考博客: https://www.cnblogs.com/haogj/p/4885928.html 原文地址:http://www.ng-newsletter.com/posts/angular-u ...

  6. html5 app开发实例 Ajax跨域访问C# webservices服务

    通过几天的研究效果,如果在vs2010工具上通过webservice还是比较简单的,毕竟是一个项目. 如果您想通过HTML5 做出来的移动APP去访问c#做出来的webservice,那么就没那么简单 ...

  7. webpack前端构建工具学习总结(二)之loader的使用

    Webpack 本身只能处理 JavaScript 模块,如果要处理其他类型的文件,就需要使用 loader 进行转换. Loader 可以理解为是模块和资源的转换器,它本身是一个函数,接受源文件作为 ...

  8. Samuraiwtf-解决sshd安装启动

    东西没仔细看就给别人了,具体是系统默认的sshd怎么都起不来.于是重新安装一下,过程如下 root@samuraiwtf:~# netstat -nlt Active Internet connect ...

  9. IOS 九宫图解锁(封装)

    NJLockView.h /.m @class NJLockView; @protocol NJLockViewDelegate <NSObject> - (void)lockViewDi ...

  10. PAT (Advanced Level) Practise - 1095. Cars on Campus (30)

    http://www.patest.cn/contests/pat-a-practise/1095 Zhejiang University has 6 campuses and a lot of ga ...