Obscure Exception in Windows Forms Code

V

VoxCode LLC

I have been plagued with seemingly random crashes in my Windows Forms
application. It's hard to pinpoint when the crash occurs bu is often when
minimizing the app or closing it. I am clueless as to what the problem is
and it was happening in 1.0 and now 1.1 framework. I can sort of repro it
by clicking on abunch of things in my app (basically exercise the app a but
and then when I close it the app may or may not crash). This is the closest
I have gotten to a repro. The call stack looks like this:

System.windows.forms.dll!System.Windows.Forms.UnsafeNativeMethods.DestroyWin
dow(System.Runtime.InteropServices.HandleRef hWnd =
{System.Runtime.InteropServices.HandleRef})
system.windows.forms.dll!System.Windows.Forms.NativeWindow.DestroyHandle()
system.windows.forms.dll!System.Windows.Forms.Control.DestroyHandle()
system.windows.forms.dll!System.Windows.Forms.Application.ParkingWindow.Dest
roy()
system.windows.forms.dll!ThreadContext.DisposeParkingWindow()
system.windows.forms.dll!ThreadContext.DisposeThreadWindows()
system.windows.forms.dll!System.Windows.Forms.Application.ComponentManager.S
ystem.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMessageLoo
p(int dwComponentID = 1, int reason = -1, int pvLoopData = 0)
system.windows.forms.dll!ThreadContext.RunMessageLoopInner(int reason = -1,
System.Windows.Forms.ApplicationContext context =
{System.Windows.Forms.ApplicationContext})
system.windows.forms.dll!ThreadContext.RunMessageLoop(int reason = -1,
System.Windows.Forms.ApplicationContext context =
{System.Windows.Forms.ApplicationContext})
system.windows.forms.dll!System.Windows.Forms.Application.Run(System.Windows
..Forms.Form mainForm = {VssConnectClient.MainForm})
VssConnectClient.exe!VssConnectClient.MainForm.Main(string[] args =
{Length=0}) Line 474

The exception is this:

A first chance exception of type 'System.NullReferenceException' occurred in
system.windows.forms.dll

Additional information: Object reference not set to an instance of an object

Anybody seen this kind of exception?

Thanks - Joel
 
V

VoxCode LLC

Here is an example of another one this time when alt-tabing to another app.

system.windows.forms.dll!System.Windows.Forms.Application.ComponentManager.S
ystem.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMessageLoo
p(int dwComponentID = 1, int reason = -1, int pvLoopData = 0)
system.windows.forms.dll!ThreadContext.RunMessageLoopInner(int reason = -1,
System.Windows.Forms.ApplicationContext context =
{System.Windows.Forms.ApplicationContext})
system.windows.forms.dll!ThreadContext.RunMessageLoop(int reason = -1,
System.Windows.Forms.ApplicationContext context =
{System.Windows.Forms.ApplicationContext})
system.windows.forms.dll!System.Windows.Forms.Application.Run(System.Windows
..Forms.Form mainForm = {VssConnectClient.MainForm})
VssConnectClient.exe!VssConnectClient.MainForm.Main(string[] args =
{Length=0}) Line 474

I am beginning to regret my choice of platform!

Joel

VoxCode LLC said:
I have been plagued with seemingly random crashes in my Windows Forms
application. It's hard to pinpoint when the crash occurs bu is often when
minimizing the app or closing it. I am clueless as to what the problem is
and it was happening in 1.0 and now 1.1 framework. I can sort of repro it
by clicking on abunch of things in my app (basically exercise the app a but
and then when I close it the app may or may not crash). This is the closest
I have gotten to a repro. The call stack looks like this:

System.windows.forms.dll!System.Windows.Forms.UnsafeNativeMethods.DestroyWin
dow(System.Runtime.InteropServices.HandleRef hWnd =
{System.Runtime.InteropServices.HandleRef})
system.windows.forms.dll!System.Windows.Forms.NativeWindow.DestroyHandle()
system.windows.forms.dll!System.Windows.Forms.Control.DestroyHandle()
system.windows.forms.dll!System.Windows.Forms.Application.ParkingWindow.Dest
roy()
system.windows.forms.dll!ThreadContext.DisposeParkingWindow()
system.windows.forms.dll!ThreadContext.DisposeThreadWindows()
system.windows.forms.dll!System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMessageLoo
p(int dwComponentID = 1, int reason = -1, int pvLoopData = 0)
system.windows.forms.dll!ThreadContext.RunMessageLoopInner(int reason = -1,
System.Windows.Forms.ApplicationContext context =
{System.Windows.Forms.ApplicationContext})
system.windows.forms.dll!ThreadContext.RunMessageLoop(int reason = -1,
System.Windows.Forms.ApplicationContext context =
{System.Windows.Forms.ApplicationContext})
system.windows.forms.dll!System.Windows.Forms.Application.Run(System.Windows
.Forms.Form mainForm = {VssConnectClient.MainForm})
VssConnectClient.exe!VssConnectClient.MainForm.Main(string[] args =
{Length=0}) Line 474

The exception is this:

A first chance exception of type 'System.NullReferenceException' occurred in
system.windows.forms.dll

Additional information: Object reference not set to an instance of an object

Anybody seen this kind of exception?

Thanks - Joel
 
C

Chris Willis

We get the same problem (NullReferenceException) using UserControls embedded
in InternetExplorer. We also get SEHException as well as an
ExecutingEngineException, all of which aren't ever supposed to be thrown
since all of our code is purely managed. Probably a bug in the runtime, as
it seems like the underlying engine gets corrupted, as if the runtime is
calling methods on a window that has been destroyed or corrupted somehow.
Help from the MSFT dudes would be nice on this one.

VoxCode LLC said:
Here is an example of another one this time when alt-tabing to another app.system.windows.forms.dll!System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMessageLoo
p(int dwComponentID = 1, int reason = -1, int pvLoopData = 0)
system.windows.forms.dll!ThreadContext.RunMessageLoopInner(int reason = -1,
System.Windows.Forms.ApplicationContext context =
{System.Windows.Forms.ApplicationContext})
system.windows.forms.dll!ThreadContext.RunMessageLoop(int reason = -1,
System.Windows.Forms.ApplicationContext context =
{System.Windows.Forms.ApplicationContext})
system.windows.forms.dll!System.Windows.Forms.Application.Run(System.Windows
.Forms.Form mainForm = {VssConnectClient.MainForm})
VssConnectClient.exe!VssConnectClient.MainForm.Main(string[] args =
{Length=0}) Line 474

I am beginning to regret my choice of platform!

Joel

VoxCode LLC said:
I have been plagued with seemingly random crashes in my Windows Forms
application. It's hard to pinpoint when the crash occurs bu is often when
minimizing the app or closing it. I am clueless as to what the problem is
and it was happening in 1.0 and now 1.1 framework. I can sort of repro it
by clicking on abunch of things in my app (basically exercise the app a but
and then when I close it the app may or may not crash). This is the closest
I have gotten to a repro. The call stack looks like this:
System.windows.forms.dll!System.Windows.Forms.UnsafeNativeMethods.DestroyWin
dow(System.Runtime.InteropServices.HandleRef hWnd =
{System.Runtime.InteropServices.HandleRef})
system.windows.forms.dll!System.Windows.Forms.NativeWindow.DestroyHandle()
system.windows.forms.dll!System.Windows.Forms.Control.DestroyHandle()
system.windows.forms.dll!System.Windows.Forms.Application.ParkingWindow.Destsystem.windows.forms.dll!System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMessageLoo
p(int dwComponentID = 1, int reason = -1, int pvLoopData = 0)
system.windows.forms.dll!ThreadContext.RunMessageLoopInner(int reason = -1,
System.Windows.Forms.ApplicationContext context =
{System.Windows.Forms.ApplicationContext})
system.windows.forms.dll!ThreadContext.RunMessageLoop(int reason = -1,
System.Windows.Forms.ApplicationContext context =
{System.Windows.Forms.ApplicationContext})
system.windows.forms.dll!System.Windows.Forms.Application.Run(System.Windows
.Forms.Form mainForm = {VssConnectClient.MainForm})
VssConnectClient.exe!VssConnectClient.MainForm.Main(string[] args =
{Length=0}) Line 474

The exception is this:

A first chance exception of type 'System.NullReferenceException'
occurred
in
system.windows.forms.dll

Additional information: Object reference not set to an instance of an object

Anybody seen this kind of exception?

Thanks - Joel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top