Handling unhandled exceptions from addins in different processes

Oct 7, 2008 at 8:50 AM
Edited Oct 7, 2008 at 8:56 AM
Hello all

I’m having trouble catching exceptions not handled by addins loaded in another process using the System.AddIn model.

If I use the ReliableExtensibleCalculator example, and change the method:
private static Calculator ActivateCalculator(AddInToken calcToken)
    return calcToken.Activate<Calculator>(AddInSecurityLevel.FullTrust);

… to (Adding “new AddInProcess(), ”:

private static Calculator ActivateCalculator(AddInToken calcToken)
    return calcToken.Activate<Calculator>(new AddInProcess(), AddInSecurityLevel.FullTrust);

The example fails to run.
An exception is thrown in the method “LogUnhandledExceptions”, because “controller.AppDomain” returns null.

From the documentation it reads (http://msdn.microsoft.com/en-us/library/system.addin.hosting.addincontroller.aspx):
“Use the AppDomain property to obtain an AppDomain object for an add-in. Then use that object to activate other add-ins in the same application domain as the original add-in. Note that because of limitations in cross-process remoting, this scenario will not work with add-ins that are activated in a separate process.”

The last bit of information, tells me that it's not possible to get the AppDomain if the addin is loaded into another process.
So how am I able to do it then? Is it possible?

What I want to know is, when my addins fail, and be able to load it/them in again if necessary.

Can you help?

Best regards
Claus Nielsen