Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4172772
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T00:36:12+00:00 2026-05-21T00:36:12+00:00

We have an application which, as one of its requirements, will take arbitrary 3rd

  • 0

We have an application which, as one of its requirements, will take arbitrary 3rd party plugins, load them, and run their UI alongside our home-grown application. We’ve been loading these 3rd party plugins into their own AppDomains for isolation purposes, and everything works ok.

Until one of the plugins crashes out with an unhandled exception. In this circumstance, the entire application goes down, even though all that is really affected is one of our ‘extra’ tool windows.

We’d like, ideally, some way to handle the “unhandled” exception, unload the damaged AppDomain, and then just reload it fresh. The problem is that we can’t find a mechanism in the event handler for the unhandled exception whereby we can flag the exception as being ‘handled’. Further, since the plugins have their own UI components with their own set of interactions with the user, it would be extremely difficult to “wrap” our interactions with the plugins in try/catch/finally blocks.

Are there any frameworks/programming libraries/patterns that lend themselves to solving this problem? We can do plugin stuff fine; what we need help with is keeping the application alive when code in a different AppDomain fails unexpectedly.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T00:36:12+00:00Added an answer on May 21, 2026 at 12:36 am

    You can use the System.Addin framework (sometimes known as MAF), which is a bit of a hassle to set up correctly, but which was designed to provide isolation (crash protection). System.Addin is based on remoting. With this framework you can let plugins run with limited permissions, in the same process, or in another app-domain, or even in another process.

    If you need total crash protection you may need to use the process separation option. It may come at the cost of performance though.

    You can use this code to load an addin in a different app domain:

    AppDomain addInDomain = AppDomain.CreateDomain("addin domain");
    
    // addInDomain.PermissionSet = ...
    AddInEnvironment env = new AddInEnvironment(addInDomain);
    
    // Activate the add-in
    IHostView addinInstance = addinToken.Activate<IHostView>(env);
    
    Console.WriteLine(addinInstance.DoSomething());
    
    AppDomain.Unload(addInDomain);
    

    If you want to load the addin into another process, for complete isolation:

    AddInProcess process = new AddInProcess();
    process.Start();
    
    // Activate the add-in
    IHostView addinInstance = addinToken.Activate<IHostView>(process, AddInSecurityLevel.Internet);
    
    try 
    {
        // use a catch block, prevent exceptions from the addin crashing the main app
        Console.WriteLine(addinInstance.DoSomething());
    } 
    catch (Exception e)
    {
        Console.WriteLine(e);
    }
    
    process.Shutdown();
    

    This blog gives a good description of setting this up.

    It is possible to combine System.Addin with MEF, these are complimentary toolkits, see this article.

    Note that the System.Addin model may provide crash protection, you will still need to deal with slowdowns or deadlocks in the addin code. Asynchronous usage will help here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Java application which requires certain software (one of them being Perl)
I have developed one application which will have activities and one background service and
I have one application which uses the standard .NET forms authentication cookie, now I
I have an application which may only have one instance of itself open at
I have an application which obtains data in JSON format from one of our
My application is viewbased application in which I have one button. On click of
The problem: we have one application that has a portion which is used by
Hai every one I am developing an windows application in which i have to
I have an MVVM application. In one of the ViewModels is the 'FindFilesCommand' which
I have two windows application, one is a windows service which create EventWaitHandle and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.