ObjectDisposedException while closing the application

M

mind_the_gap

Hi,

when I close my application down I get an ObjectDisposedException. As
far as I understand and read this is cause to some object which is
already disposed but gets called somehow.
Unfortunately, I can not get to the point where this happens with
debugging. The Error comes up after the Main() has finished.

1. Is there a way to get to the place where all this happens or which
object causes this exception?
2. Can I somehow catch this exception?

The stacktrace I get:

System.ObjectDisposedException was unhandled
Message=""
ObjectName=""
StackTrace:
at Microsoft.AGL.Common.MISC.HandleAr(PAL_ERROR ar)
at System.Windows.Forms.Control.get_Parent()
at System.Windows.Forms.Control.WnProc(WM wm, Int32 wParam,
Int32 lParam)
at System.Windows.Forms.ToolBar.WnProc(WM wm, Int32 wParam,
Int32 lParam)
at System.Windows.Forms.Control._InternalWnProc(WM wm, Int32
wParam, Int32 lParam)


Thanks in advance,
Tom
 
M

mind_the_gap

I still do not know why all this happens - so my questions are still
there - but I managed it to do a workaround.

To close my application I used just Application.Exit()
If I add
mainForm.BeginInvoke(new CloseDelegate(mainForm.Close));

before Application.Exit() and specify the delegate
delegate void CloseDelegate();

it works - please, can anyone explain this to me?

thanks,
Tom
 

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