views:

87

answers:

3

I'm working with a 3rd party executable that I can't recompile (vendor is no longer available). It was originally written under .Net 1.1 but seems to work fine under later versions as well. I launch it using Process.Start from my own application (I've tried p/invoke CreateProcess as well with the same results so that's not relevant)

Unfortunately this 3rd party app now throws an unhandled exception as it exits. The Microsoft dialog box has a title like "Exception thrown from v2.0 ... Broadcast Window" with the version number relating to the version of .Net it's running under (I can use a .exe.config file to target different .Net versions, doesn't help).

The unhandled exception dialog box on exit doesn't cause any real problems, but is troubling to my users who have to click OK to dismiss it every time. Is there any way (a config file option perhaps) to disable this dialog from showing for an app I don't have the source code to? I've considered loading it in a new AppDomain which would give me access to the UnhandledException event but there's no indication I could change the appearence of the dialog. Maybe someone knows what causes the exception and I can fix this some other way?

+2  A: 

You could write a wrapper application that calls the 3rd party application directly and launch your application using Process.Start.

Then in your wrapper application trap the exception so the users won't see the error message.

ChrisF
It's doable but you provide too little information :)
Lex Li
A: 

If it hasn't been obfuscated you may be able to decompile it? This is of course illegal etc. but if the company has actually gone bankrupt then no one is there to pursue it. It is reasonable for you to support the code if you have no other choice.

Reflector might give you a clue as to why the code crashes as well, perhaps you need to do something or call it with a parameter to stop it from doing so?

Spence
A: 

Next time don't try to use something without source code :)

A workaround is to follow Chris' suggestion. A wrapper application can make use of such code,

http://blog.jtbworld.com/2007/06/windows-live-writer-spell-checking.html

  1. Find the old application executable.
  2. Execute it in an AppDomain object created in the wrapper application.
  3. Bind your application unhandled exception handler to this AppDomain object's UnhandledException event.

http://msdn.microsoft.com/en-us/library/system.appdomain.unhandledexception.aspx

Lex Li