2
votes

I am having a problem with Visual Studio 2010 crashing when opening a WPF user control on one computer. Whenever I open any WPF user control or try to create a new WPF user control in our product solution (any project in the solution), Visual Studio crashes.

I have uninstalled or disabled all Visual Studio add-ins (such as ReSharper and .NET Reflector) and reinstalled Visual Studio 2010 itself (along with Silverlight and the .NET Framework 4.0), but this has not helped.

I can create a new WPF solution and the WPF editor starts successfully for the newly created window. However, on other similarly configured computers, we can successfully open the user controls in our product solution so it does not appear to be a problem with the solution or user controls themselves.

The information in the error report for the crash looks like this:

EventType : 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

If I debug Visual Studio during the crash, the call stack for the crash looks like this:

Microsoft.VisualStudio.Shell.10.0.dll!Microsoft.VisualStudio.Shell.ServiceProvider.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(object arg) + 0xd bytes

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 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(object state) Line 337 + 0x7 bytes C# mscorlib.dll!System.Threading.ExecutionContext.runTryCode(object userData) Line 484 + 0xe bytes C# [Native to Managed Transition]
[Managed to Native Transition]
mscorlib.dll!System.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 callback, object state, bool ignoreSyncCtx) Line 447 + 0xd bytes 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 handled) 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 handled = false) Line 344 + 0x15 bytes 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 method, object args, int numArgs, System.Delegate catchHandler = null) Line 41 + 0xd bytes C# WindowsBase.dll!System.Windows.Threading.Dispatcher.InvokeImpl(System.Windows.Threading.DispatcherPriority priority, System.TimeSpan timeout, System.Delegate method, object args, int numArgs) Line 851 + 0x3b bytes C# WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd = 2032464, int msg = 49716, System.IntPtr wParam = 0, System.IntPtr lParam = 0) Line 398 C#

1
(i can see it's been a while) Have you tried asking Microsoft to review your crash on Microsoft Connect? If so, could you link this question to that discussion?GregC

1 Answers

2
votes

I would recommend you put a try/catch block around every event handler in your custom control, if at all possible.