all groups > dotnet windows forms > august 2004 >
You're in the

dotnet windows forms

group:

Crash deep in S.W.F.dll: UnsafeNativeMethods.CallWindowProc


Crash deep in S.W.F.dll: UnsafeNativeMethods.CallWindowProc Matt Holmes
8/6/2004 7:57:03 AM
dotnet windows forms: I am getting a very strange crash deep inside the S.W.F.dll when closing a
window. Basically when the Window 'X' is pushed, or I call 'this.Close();'
from inside the form, I get a crash inside the main WinForms DLL. I have done
some deep debugging via the disassembly of that DLL, and it appears to be
happening inside the NativeWindow.DefWndProc method. When this method
attempts to call UnsafeNativeMethods.CallWindowProc, a NullReferenceException
is raised and the program crashes. Also of interest is the fact that the
windows Closing event is never fired, so this is obviously happening as the
primary WM_CLOSE message is being pumped.

Has anyone else experienced this problem, and if so, is there a workaround?
Obviously I don't want to go editing the IL of the S.W.F DLL just to fix the
Stack Trace Matt Holmes
8/6/2004 8:03:01 AM
Here is the stack trace, if anyone is interested:
System.NullReferenceException: Object reference not set to an instance of an
object.
at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr
wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at System.Windows.Forms.NativeWindow.DefWndProc(Message& m) in
System.Windows.Forms.il:line 65766
at System.Windows.Forms.Control.DefWndProc(Message& m) in
System.Windows.Forms.il:line 46486
at System.Windows.Forms.Form.DefWndProc(Message& m) in
System.Windows.Forms.il:line 225445
at System.Windows.Forms.Control.WndProc(Message& m) in
System.Windows.Forms.il:line 61304
at System.Windows.Forms.ScrollableControl.WndProc(Message& m) in
System.Windows.Forms.il:line 70129
at System.Windows.Forms.ContainerControl.WndProc(Message& m) in
System.Windows.Forms.il:line 72153
at System.Windows.Forms.Form.WmSysCommand(Message& m) in
System.Windows.Forms.il:line 231382
at System.Windows.Forms.Form.WndProc(Message& m) in
System.Windows.Forms.il:line 231664
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m) in
System.Windows.Forms.il:line 28004
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m) in
System.Windows.Forms.il:line 28096
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
AddThis Social Bookmark Button