Visual Studio 2010崩溃,打开WPF用户控件

问题描述:

我在打开一台计算机上的WPF用户控件时,出现Visual Studio 2010崩溃问题。无论何时我打开任何WPF用户控件或尝试在我们的产品解决方案(解决方案中的任何项目)中创建新的WPF用户控件时,Visual Studio都会崩溃。Visual Studio 2010崩溃,打开WPF用户控件

我已经卸载或禁用了所有Visual Studio加载项(如ReSharper和.NET Reflector)并重新安装了Visual Studio 2010本身(以及Silverlight和.NET Framework 4.0),但这并没有帮助。

我可以创建一个新的WPF解决方案,WPF编辑器可以成功启动新创建的窗口。但是,在其他类似配置的计算机上,我们可以成功打开我们产品解决方案中的用户控件,以便解决方案或用户控件本身不会出现问题。

在崩溃的错误报告中的信息是这样的:

事件类型:clr20r3 P1:devenv.exe的P2:10.0.30319.1 P3:4ba1fab3 P4:microsoft.visualstudio.shell.10.0 P5:10.0 .0.0 P6:4ba1e1f5
P7:506 P8:13点P9信息:system.ArgumentNullException

如果我在崩溃期间调试Visual Studio中,坠机调用堆栈看起来是这样的:

Microsoft.VisualStudio.Shell .10.0.dll!Microsoft.VisualStudio.Shell.Ser viceProvider.ServiceProvider(Microsoft.VisualStudio.OLE.Interop.IServiceProvider sp,bool defaultServices)+ 0x48 bytes Microsoft.VisualStudio.Xaml.dll!MS.Internal.Package.Toolbox.AutoToolboxProjectManager.VSProject.get()+ 0x7c bytes Microsoft .VisualStudio.Xaml.dll!MS.Internal.Package.Toolbox.AutoToolboxProjectManager.AutoToolboxProjectManager(Microsoft.VisualStudio.Shell.Interop.IVsHierarchy hierarchy,System.IServiceProvider provider,Microsoft.VisualStudio.Shell.Interop.IVsSmartOpenScope smartOpenScope)+ 0x109 bytes Microsoft.VisualStudio.Xaml.dll!MS.Internal.Package.Toolbox.AutoToolboxManagerService.Update(Microsoft.VisualStudio.Shell.Interop.IVsHierarchy hierarchy = {System .__ ComObject},bool force = false)+ 0x7a bytes Microsoft.VisualStudio。 Xaml.dll!MS.Internal.Package.Toolbox.AutoToolboxManagerService.Start()+ 0x81 bytes Microsoft.VisualStudio.Xaml.dll!MS.Internal.Package.DesignerPackage.Initialize.AnonymousMethod__0(对象ARG)+ 0xd中字节

WindowsBase.dll中!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback,object args,int numArgs)行111 + 0xb字节C# WindowsBase.dll!MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(object source = {System.Windows.Threading.Dispatcher},System.Delegate method,object args, int numArgs,System.Delegate catchHandler = null)Line 41 + 0xd bytes C# WindowsBase.dll!System.Windows.Threading.DispatcherOperation.InvokeImpl()Line 360​​ + 0x52 bytes C# WindowsBase.dll!System.Windows.Threading.DispatcherOperation .InvokeInSecurityContext(对象状态)行337 + 0x7的字节C# mscorlib.dll中!System.Threading.ExecutionContext.runTryCode(对象的UserData)线484 + 0xe字节C# [原产于托管过渡]
[托管到纯过渡]
mscorlib.dll中!系统。 Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext,System.Threading.ContextCallback callback,object state)Line 461 + 0x12 bytes C# mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext,System .Threading.ContextCallback回调,对象状态,布尔ignoreSyncCtx)行447 + 0xd字节C# mscorlib。dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext,System.Threading.ContextCallback callback,object state)Line 411 + 0xc bytes C# WindowsBase.dll!System.Windows.Threading.DispatcherOperation.Invoke()Line 303 + 0xffffff73 bytes C# WindowsBase.dll!System.Windows.Threading.Dispatcher.ProcessQueue()Line 1567 C# WindowsBase.dll!System.Windows.Threading.Dispatcher.WndProcHook(System.IntPtr hwnd,int msg,System.IntPtr wParam,System.IntPtr lParam,ref bool handling)Line 1811 C# WindowsBase.dll!MS.Win32.HwndWrapper.WndProc(System.IntPtr hwnd = 2032464,int msg = 49716,System.IntPtr wParam = 0,System.IntPtr lParam = 0,ref bool handles = false)行344 + 0x15字节C# WindowsBase.dll!MS.Win32.HwndSubclass.DispatcherCallbackOperation(object o)Line 494 + 0x18 bytes C# WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback,object args,int numArgs)Line 111 + 0xb bytes C# WindowsBase.dll!MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(object source = {System.Windows.Threading.Dispatcher},System.Delegate方法,对象args,int numArgs,System.Delegate catchHandler = null)41行+ 0xd字节C# WindowsBase.dll!System.Windows.Threading.Dispatcher.InvokeImpl(System Windows.Threading.DispatcherPriority优先级,System.TimeSpan超时,System.Delegate方法,对象参数, int msg = 49716,System.IntPtr wParam = 0,System.IntPtr lParam = 0)398行C#

+0

(我可以看到它已经有一段时间了)你有没有试过要求微软检查你在Microsoft Connect上的崩溃?如果是这样,你能把这个问题与这个讨论联系起来吗? – GregC 2011-04-15 21:47:01

我会建议你在自定义控件中的每个事件处理程序周围放置一个try/catch块,如果可能的话。