Re: Handling non-user code Exceptions

From: Dmitriy Lapshin [C# / .NET MVP] (x-code_at_no-spam-please.hotpop.com)
Date: 12/07/04


Date: Tue, 7 Dec 2004 12:40:39 +0200

See MSDN docs on:

Application class, ThreadException event
AppDomain class, UnhandledException event

Also, try to figure out a pattern causing the exception to occur and add
exception handlers to the parts of code involved in the pattern.
Judging by the call stack, it looks like there's a faulty control or some
fancy P/Invoke takes place...

-- 
Sincerely,
Dmitriy Lapshin [C# / .NET MVP]
Bring the power of unit testing to the VS .NET IDE today!
http://www.x-unity.net/teststudio.aspx
"vooose" <nospam@microsoft.com> wrote in message 
news:uG55Uz%232EHA.3840@tk2msftngp13.phx.gbl...
> Is there any way to handle exceptions thrown by .NET classses? During
> runtime and at seemingly random times, exceptions similar to the ones
> shown at the base of this post are thrown.  These errors turn themselves
> into serious problems because they usually result in the application
> having to exit, even though the user clicks 'Continue'.  There doesnt
> appear to be much information regarding these issues on forums - does
> anyone know a way to handle these and stop the application from exiting?
>
>
>
>
> ************** Exception Text **************
> System.NullReferenceException: Object reference not set to an instance
> of an object.
>   at System.Windows.Forms.WndProc.Invoke(IntPtr hWnd, Int32 msg, IntPtr
> wParam, IntPtr lParam)
>   at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr
> wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
>   at System.Windows.Forms.NativeWindow.DefWndProc(Message& m)
>   at System.Windows.Forms.Control.DefWndProc(Message& m)
>   at System.Windows.Forms.Control.WmUpdateUIState(Message& m)
>   at System.Windows.Forms.Control.WndProc(Message& m)
>   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
>   at System.Windows.Forms.ContainerControl.WndProc(Message& m)
>   at System.Windows.Forms.ParkingWindow.WndProc(Message& m)
>   at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
>   at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
>   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
> IntPtr wparam, IntPtr lparam)
>
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it! 


Relevant Pages


Loading