Click here to Skip to main content
15,886,199 members
Home / Discussions / C#
   

C#

 
AnswerRe: Application Crashes during AppDomain.Unload Pin
gavindon13-Apr-11 3:56
gavindon13-Apr-11 3:56 
GeneralRe: Application Crashes during AppDomain.Unload Pin
Benny_Lava13-Apr-11 9:41
Benny_Lava13-Apr-11 9:41 
AnswerRe: Application Crashes during AppDomain.Unload Pin
Not Active13-Apr-11 3:57
mentorNot Active13-Apr-11 3:57 
GeneralRe: Application Crashes during AppDomain.Unload Pin
Benny_Lava13-Apr-11 9:25
Benny_Lava13-Apr-11 9:25 
AnswerRe: Application Crashes during AppDomain.Unload Pin
BobJanova13-Apr-11 6:18
BobJanova13-Apr-11 6:18 
GeneralRe: Application Crashes during AppDomain.Unload Pin
Benny_Lava13-Apr-11 9:38
Benny_Lava13-Apr-11 9:38 
GeneralRe: Application Crashes during AppDomain.Unload Pin
BobJanova13-Apr-11 10:57
BobJanova13-Apr-11 10:57 
GeneralRe: Application Crashes during AppDomain.Unload Pin
Benny_Lava13-Apr-11 22:06
Benny_Lava13-Apr-11 22:06 
Hi,

After a session of debugging using all advices I collected, here are my findings (So everybody can learn from my mistakes... Smile | :) )

-A plugin can be unloaded from a different thread (other thread then the one that spawned it
-The problem was that I also handled UnhandledException event of the AppDomain, and a series of unfortunate events happened:

*I have 2 mechanisms for protecting my core system from plugins:
1. A watchdog timer mechanism that terminates a plugin if the plugin hasn't responded (raised an watch dog timer event) for a certain period of time
2.A UnhandledException event handler for when an unhandled error occurs in the plugin, and in that event i call UnloadPlugin function and remove the plugin from the core system

So a plugin spawned an unhandled exception the same time the watchdog timer called UnloadPlugin function... And in the UnhandledException handler it tried to use data and unload an already unloaded AppDomain

So the solution is to develop some kind of synchronization mechanism so if one request for termination comes that no other request are processed.

So the bottom line is "Threads are evil" Wink | ;)

Thanks for your help.
AnswerRe: Application Crashes during AppDomain.Unload Pin
jschell13-Apr-11 8:46
jschell13-Apr-11 8:46 
Questionrefreshing second combo by first not working Pin
uglyeyes13-Apr-11 1:11
uglyeyes13-Apr-11 1:11 
AnswerRe: refreshing second combo by first not working Pin
#realJSOP13-Apr-11 2:16
mve#realJSOP13-Apr-11 2:16 
GeneralRe: refreshing second combo by first not working [modified] Pin
uglyeyes13-Apr-11 2:51
uglyeyes13-Apr-11 2:51 
GeneralRe: refreshing second combo by first not working Pin
gavindon13-Apr-11 3:30
gavindon13-Apr-11 3:30 
QuestionScreen Shield Pin
Enobong Adahada13-Apr-11 0:59
Enobong Adahada13-Apr-11 0:59 
AnswerRe: Screen Shield Pin
Richard MacCutchan13-Apr-11 2:50
mveRichard MacCutchan13-Apr-11 2:50 
AnswerRe: Screen Shield Pin
Dave Kreskowiak13-Apr-11 6:07
mveDave Kreskowiak13-Apr-11 6:07 
AnswerRe: Screen Shield Pin
Eddy Vluggen13-Apr-11 10:43
professionalEddy Vluggen13-Apr-11 10:43 
AnswerRe: Screen Shield Pin
wizardzz13-Apr-11 11:25
wizardzz13-Apr-11 11:25 
Questionwebsite publishing problem Pin
S.Aijaz13-Apr-11 0:05
S.Aijaz13-Apr-11 0:05 
AnswerMy Vote of 1 [modified] Pin
Keith Barrow13-Apr-11 2:13
professionalKeith Barrow13-Apr-11 2:13 
QuestionOperator overloading, when to Pin
Niklas L12-Apr-11 22:23
Niklas L12-Apr-11 22:23 
AnswerRe: Operator overloading, when to Pin
_Erik_12-Apr-11 22:37
_Erik_12-Apr-11 22:37 
AnswerRe: Operator overloading, when to Pin
David198712-Apr-11 22:50
David198712-Apr-11 22:50 
AnswerRe: Operator overloading, when to Pin
BobJanova13-Apr-11 1:20
BobJanova13-Apr-11 1:20 
AnswerRe: Operator overloading, when to Pin
PIEBALDconsult13-Apr-11 2:59
mvePIEBALDconsult13-Apr-11 2:59 

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.