tags:

views:

60

answers:

2

I have two .Net applications running on client machine.One is IMSOperations and other is IMSInvoice.Both are windows forms application using C#.

What happens is when both of these applications are running,after some time IMSOperations gets automatically closed.

What i tried is to find reason of closing by subscribing to main form's Form_Closing() event.IS there any other way to figure out what's going on and why is that application getting closed.

A: 

Is it a clean exit? or its throwing an exception?

If its the first there must be some code that checks the status of the other application. If its the latter you have to find the source of the crash.

Marcom
Might also suggest checking the Windows Event Viewer
AutomatedTester
no exceptions are thrown.its clean exit.
Rohit
might be a long shot, but try searching for Application.Exit() or close in your code and see if there any instances when it closes on its own???
Marcom
If you have an unhandled exception coming not from the main thread your application just dies (which might look like a clean exit).
0xA3
+1  A: 

Might I suggest adding these to make sure no exception is being thrown:

You need to add this line to your Main():

AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);

and add appropriate handlers to display any exceptions.

(ThreadException handles exceptions UI thread exceptions. UnhandledException handles non-UI thread exceptions.)

serialhobbyist