i have one very annoying problem.
I'm dynamicaly loading assemblies, which have forms in it. The problem is that whenever i close ANY form from assembly which si the last which wasn't closed - i get exception which kills my application.
loading code:
Assembly a = Assembly.LoadFrom(Common.Config.Path + pb.CallAssembly);
FormBase f = (FormBase)a.CreateInstance(pb.CallClass);
f.Show();
the exception i get:
at Microsoft.AGL.Common.MISC.HandleAr(PAL_ERROR ar)
at System.Windows.Forms.Control.get_Text()
at Common.Controls.TextBoxExtended.HandleMask()
at Common.Controls.TextBoxExtended.OnKeyUp(KeyEventArgs e)
at System.Windows.Forms.Control.WnProc(WM wm, Int32 wParam, Int32 lParam)
at System.Windows.Forms.Control._InternalWnProc(WM wm, Int32 wParam, Int32 lParam)
at Microsoft.AGL.Forms.EVL.EnterMainLoop(IntPtr hwnMain)
at System.Windows.Forms.Application.Run(Form fm)
at xxxxxxxxxX.Program.Main()
The thing is that no matter which form i close, if it's the last one open in assembly-it makes exception. Maybe Windows Mobile 6.5 tries to dispose last object and then release assembly which is not good and application hangs.
Am also using MultiThreading. And events, but before closing i unregistering from all events form is listening to.
Is there any way to catch such exceptions? i would like to ignore them. If i can't fix