Click here to Skip to main content
15,884,895 members
Home / Discussions / C#
   

C#

 
GeneralRe: webp Pin
Pete O'Hanlon15-Apr-11 9:18
mvePete O'Hanlon15-Apr-11 9:18 
AnswerRe: webp Pin
#realJSOP15-Apr-11 9:11
mve#realJSOP15-Apr-11 9:11 
GeneralRe: webp Pin
Pete O'Hanlon15-Apr-11 9:16
mvePete O'Hanlon15-Apr-11 9:16 
GeneralRe: webp Pin
#realJSOP15-Apr-11 9:51
mve#realJSOP15-Apr-11 9:51 
GeneralRe: webp Pin
Pete O'Hanlon15-Apr-11 9:56
mvePete O'Hanlon15-Apr-11 9:56 
AnswerRe: webp Pin
Prasanta_Prince16-Apr-11 7:26
Prasanta_Prince16-Apr-11 7:26 
AnswerRe: webp Pin
RaviRanjanKr20-Apr-11 9:48
professionalRaviRanjanKr20-Apr-11 9:48 
QuestionRobust plugin system Pin
Benny_Lava15-Apr-11 6:23
Benny_Lava15-Apr-11 6:23 
Hi,

I know I posted a similar question a couple of days ago and I'm sorry about that but i'm going crazy about this problem...

So I will simplify the scenario.

I am developing a plugin system for a windows service application.

The plugin system has been developed with the AppDomain paradigm. I won't get into details of how my system works, but will demonstrate in a simple code example (of which I tried


//--This is an external assembly project (.dll)
namespace Foo
{
    [Serializable]
    public class Foo
    {
        Thread workThread_;

        public void Initialize()
        {
            workThread_ = new Thread(new ThreadStart(DoWork));
            workThread_.Start();
        }

        public void DoWork()
        {
            int i = 0;

            while (i < 500)
                i++;

            throw new Exception("Unhandled exception");
        }
    }
}

namespace AppDomainTest
{
    public class Bar
    {

        AppDomain new_domain;

        public Bar()
        {
           
        }

        private void new_domain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
           //--Cleanup new_domain and dispose it
            new_domain = null;
	    
	    //--After this event handler finishes so the main application process finishes although the event handler is subsrcibed on foo_test
        }

        public void InitializeBar()
        {
            Foo.Foo foo_test;

            new_domain = AppDomain.CreateDomain("Auxilary domain");
            foo_test = (Foo.Foo)new_domain.CreateInstanceFromAndUnwrap("Foo.dll", "Foo.Foo");
            
            new_domain.UnhandledException += new UnhandledExceptionEventHandler(new_domain_UnhandledException);

            foo_test.Initialize();
        }
    }
}


I kept reading about AppDomains and how they are great for plugins and isolation and stability etc... but when the plugin has UnhandledException the whole application crashes with its main AppDomain crashing...
In my case a plugin can spawn multiple threads to do its work and those threads never interact with the core system, only through raising plugin events...

So my question is how to really protect from plugin failures (Unhandled Exception), so when 1 plugin crashes the rest of the application remains intact (continues to run) bearing in mind that a plugin can spawn multiple threads to do its work?


Thank you!
See the world in a grain of sand...

AnswerRe: Robust plugin system Pin
BobJanova15-Apr-11 6:33
BobJanova15-Apr-11 6:33 
NewsRe: Robust plugin system Pin
#realJSOP15-Apr-11 9:13
mve#realJSOP15-Apr-11 9:13 
GeneralRe: Robust plugin system Pin
Benny_Lava15-Apr-11 9:37
Benny_Lava15-Apr-11 9:37 
QuestionWinform DataGridView Pin
jason_mf15-Apr-11 4:40
jason_mf15-Apr-11 4:40 
AnswerRe: Winform DataGridView Pin
Luc Pattyn15-Apr-11 5:14
sitebuilderLuc Pattyn15-Apr-11 5:14 
AnswerRe: Winform DataGridView Pin
GenJerDan15-Apr-11 6:46
GenJerDan15-Apr-11 6:46 
GeneralRe: Winform DataGridView Pin
jason_mf15-Apr-11 6:56
jason_mf15-Apr-11 6:56 
GeneralRe: Winform DataGridView Pin
GenJerDan15-Apr-11 6:59
GenJerDan15-Apr-11 6:59 
GeneralRe: Winform DataGridView Pin
jason_mf15-Apr-11 7:14
jason_mf15-Apr-11 7:14 
GeneralRe: Winform DataGridView Pin
GenJerDan15-Apr-11 15:24
GenJerDan15-Apr-11 15:24 
QuestionAjax File upload using a handler file Pin
dbongs15-Apr-11 3:53
dbongs15-Apr-11 3:53 
AnswerRe: Ajax File upload using a handler file Pin
BobJanova15-Apr-11 4:24
BobJanova15-Apr-11 4:24 
GeneralRe: Ajax File upload using a handler file Pin
dbongs17-Apr-11 22:46
dbongs17-Apr-11 22:46 
AnswerRe: Ajax File upload using a handler file Pin
Prasanta_Prince16-Apr-11 7:31
Prasanta_Prince16-Apr-11 7:31 
GeneralRe: Ajax File upload using a handler file Pin
dbongs17-Apr-11 22:52
dbongs17-Apr-11 22:52 
QuestionWeb service in asp.net using c# Pin
akosidandan14-Apr-11 19:44
akosidandan14-Apr-11 19:44 
AnswerRe: Web service in asp.net using c# Pin
Łukasz Nowakowski14-Apr-11 21:08
Łukasz Nowakowski14-Apr-11 21:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.