I wish to know if i can catch the unhandled exceptions thrown by another process which I started using the Process.Start(...)
I know i can catch the standered error using this link , but what I want is to catch the error that are usually caught by the Just In Time debugger of the.net environment, the window with the following words: "An unhandled exception has occurred in your application . If you Continue, the application will ignore this error and attempt to continue . If you click Quit, the application will be shut down immediately ...." Which is then followed by the exception message and a "Continue" and "Quit" button.
Thanks in advance.
Instead of doing the whole sneaking around the assembly to try to find the Main method like in jmservera's answer, you can simply execute the assembly in a new domain. See this msdn article
If you are calling to a .Net executable assembly you can load it and (at your own risk :D ) call to the Main method of the Program class into a try_catch statement:
But be aware of the security risks you are introducing doing that.
In resolving to the previous target invocation issue, finally i end up with the below method.
Some of your application would have dependencies in the current directory, which leads to exception whenever it is executed in the another directory since the dependencies doesnt match.
You can try something like that to avoid the debugger question to appear, you won't get the exception but only the exit code:
In this question they provided another workaround for that, but changing some registry values.
No. If the controlled app utilizes standardError and return codes you may be notified of the occurance of an error or exception but you cannot trap it in any way.