Exception in Application.Run()

G

Guest

Hi - I am getting a Null Reference Exception that is being thrown from
Application.Run() method. This ocurrs after multiple events are raised which
update a few user controls inside the Main Form.

i cannot seem to isolate the exception any further than the Run method()
even though I have placed other Excep handlers just about everywhere. Is
there any technique for investigating an exception of this kind? The full
exception text is below:

Caught Main() Exception: Message: Object reference not set to an instance of
an object.
05/04/2005 20:30:12
Source: System.Windows.Forms
Target: Boolean GetMessageW(MSG ByRef,
System.Runtime.InteropServices.HandleRef, Int32, Int32)
at System.Windows.Forms.UnsafeNativeMethods.GetMessageW(MSG& msg,
HandleRef hWnd, Int32 uMsgFilterMin, Int32 uMsgFilterMax)
at
System.Windows.Forms.ComponentManager.System.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMessageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32 reason,
ApplicationContext context)
at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason,
ApplicationContext context)
at System.Windows.Forms.Application.Run(ApplicationContext context)
at IMDFast.App.AppCtxt.Main(String[] args) in c:\vss\london\broadcast
project\station systems\master\imdvideoclient_3.0\imdfast\imdfastapp.cs:line
121
<br><br>AppDomain Info. Name: AdManager.exe
<br><br>Version: 3.1.1.0
<br><br>Machine Name: IDS-ADMIN1
<br><br>User Name: Administrator
<BR>Method: <br><br>IMDFast.App.AppCtxt.HandleException
 
C

Christof Nordiek

Hi BillyMac

You could try to handle the ThreadException event.

Simply put
Application.ThreadException += new
System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
before Application.Run(...);

and define the Handler:

static void Application_ThreadException(object sender,
System.Threading.ThreadExceptionEventArgs e)
{
// e.Exception is the exception.
......
}
 

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