469,920 Members | 2,226 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,920 developers. It's quick & easy.

.net application crashes with weird exceptions

Hi

I created an C# windows forms application that holds a user control. The
user control itself is an editor for geographical information systems and is
based on an ActiveX Library for providing basic geografic operations. It
works fine most of the time, but sometimes it crashes with weird messages
and i'm not able to track the error down - to find out the reason for this
problem. It's some kind of an memory problem - I get the message that the
programm points to an illegal memory area (where it cannot write), and then
the application exits with the stack trace below.
Another problem is that i cannot reconstruct the message - that means
sometimes it occures very often, sometimes (with the same operations
executed) it runs stable for several minutes.
Message: Object reference not set to an instance of an object.
stack trace: at
System.Windows.Forms.UnsafeNativeMethods.CallWindo wProc(IntPtr wndProc,
IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at System.Windows.Forms.NativeWindow.DefWndProc(Messa ge& m)
at System.Windows.Forms.Control.DefWndProc(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.AxHost.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage (Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(M essage& m)
at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr hWnd, Int32
msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.CallWindo wProc(IntPtr wndProc,
IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at System.Windows.Forms.NativeWindow.DefWndProc(Messa ge& m)
at System.Windows.Forms.Control.DefWndProc(Message& m)
at System.Windows.Forms.Form.DefWndProc(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Mes sage& m)
at System.Windows.Forms.ContainerControl.WndProc(Mess age& m)
at System.Windows.Forms.Form.WmSysCommand(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage (Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(M essage& m)
at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr hWnd, Int32
msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.CallWindo wProc(IntPtr wndProc,
IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at System.Windows.Forms.NativeWindow.DefWndProc(Messa ge& m)
at System.Windows.Forms.Control.DefWndProc(Message& m)
at System.Windows.Forms.Form.DefWndProc(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Mes sage& m)
at System.Windows.Forms.ContainerControl.WndProc(Mess age& m)
at System.Windows.Forms.Form.WmNcButtonDown(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage (Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(M essage& m)
at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr hWnd, Int32
msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchM essageW(MSG& msg)
at
System.Windows.Forms.ComponentManager.System.Windo ws.Forms.UnsafeNativeMetho
ds+IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason,
Int32 pvLoopData)
at System.Windows.Forms.ThreadContext.RunMessageLoopI nner(Int32 reason,
ApplicationContext context)
at System.Windows.Forms.ThreadContext.RunMessageLoop( Int32 reason,
ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at Jrs.Geo.Mogis.HostApplication.HostApp.Main() in
c:\sourcesafe\mogishostapp\classes\hostapp.cs:line 1433
The program '[3080] MogisHostApp.exe' has exited with code 0 (0x0).

Has anyone an idea - what I should do to prevent this error.

Thanks, for your time
Chris
Nov 15 '05 #1
2 1998
"Object reference not set to an instance of an object"

....is caused by prematurely calling of the object (before it is created)
or calling of an object that has been terminated elsewhere and no longer
exists (for instance threads that are running while the parent is closed,
and then tries to notify it's parent later on)

I can't really tell from the code, but it may be that the control is
terminated and then you try to access it again.
Or something in the control is terminated and then reaccessed.

--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
For a laugh, try web browsing with Opera's User Mode with Nostalgia enabled
Nov 15 '05 #2
Well - you are rigth but the problem is that this error occures very
casually and is not really reconstructable. And the objects that are listed
in the stack trace are all from the .NET framework and not from my code, so
I don't know how I can find out wants going wrong.

"Morten Wennevik" <Mo************@hotmail.com> schrieb im Newsbeitrag
news:opr1n0dzdrhntkfz@localhost...
"Object reference not set to an instance of an object"

....is caused by prematurely calling of the object (before it is created)
or calling of an object that has been terminated elsewhere and no longer
exists (for instance threads that are running while the parent is closed,
and then tries to notify it's parent later on)

I can't really tell from the code, but it may be that the control is
terminated and then you try to access it again.
Or something in the control is terminated and then reaccessed.

--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
For a laugh, try web browsing with Opera's User Mode with Nostalgia enabled
Nov 15 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Michael Zhang | last post: by
reply views Thread by Gary Cote | last post: by
5 posts views Thread by Jason MacKenzie | last post: by
reply views Thread by wolfonenet | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.