原问题
我正在使用Visual Studio 2010开发WPF应用程序,使用了Telerik
。
每当我使用设计器时,无论是点击元素、改变位置还是修改名称都会导致崩溃,同时显示以下异常:
System.ArgumentNullException
Value cannot be null.
to System.RuntimeType.MakeGenericType(Type[] instantiation)
to Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkUtil.GetRuntimeType(Type type)
to Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkType.TryGetRuntimeType()
to Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkUtil.EnsureRuntimeType(Type type)
to Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkProvider.GetRuntimeType(Type reflectionType)
[...]
我尝试了以下几件事情:
- 卸载并重新安装Telerik;
- 卸载并重新安装.NET 4.0;
- 卸载并重新安装Visual Studio。
这些尝试都没有奏效。
今天早上,我注意到设计器根本没有崩溃,我明白了为什么:当我打开或编辑XAML时,设计器会崩溃。
在打开XAML后,Visual Studio开始冻结,每次尝试单击某个东西时,设计器都会崩溃。如果我关闭Visual Studio并构建解决方案(不打开XAML),那么设计器的所有功能都可以正常运行。
我的猜测是,当Visual Studio尝试将 XAML代码转换为设计器中的图形元素 时,某些地方出了问题,而且只有在这个方向上出现问题。
问题:您是否遇到过这种情况?您对于修改XAML导致崩溃的原因和如何解决有任何想法吗?
谢谢。
阅读答案后进行的新尝试
- 调试设计器打开时的Visual Studio实例。导致
ArgumentNullException
的方法是GetRuntimeTime
。我已经能够看到.NET代码,但我无法确定问题的根源。请见下面的完整堆栈跟踪:
此外,这是错误发生的确切位置和异常详细信息。请注意,文件名为VSIsolationProviderService.cs
,我能够通过.NET Reflector Object Browser
查看源代码。
Message=Value cannot be null.
Source=mscorlib
StackTrace:
to System.RuntimeType.MakeGenericType(Type[] instantiation)
InnerException: null
最后,在异常发生时,Local Variables
检查器显示以下对象:
对象结尾:
回答评论:
- 异常发生的那行代码中
this._targetFrameworkProvider
的值如下:
_targetFrameworkProvider
是指什么吗?我明天会回答你。 - Chostakovitch