Click here to Skip to main content
15,881,173 members
Home / Discussions / C#
   

C#

 
AnswerRe: LinkedList since .NET 2 Pin
Alan Balkany14-Apr-11 4:13
Alan Balkany14-Apr-11 4:13 
GeneralRe: LinkedList since .NET 2 Pin
devvvy14-Apr-11 23:03
devvvy14-Apr-11 23:03 
GeneralRe: LinkedList since .NET 2 Pin
Pete O'Hanlon14-Apr-11 23:37
mvePete O'Hanlon14-Apr-11 23:37 
GeneralRe: LinkedList since .NET 2 Pin
devvvy14-Apr-11 23:42
devvvy14-Apr-11 23:42 
GeneralRe: LinkedList since .NET 2 Pin
Alan Balkany15-Apr-11 3:24
Alan Balkany15-Apr-11 3:24 
GeneralRe: LinkedList since .NET 2 Pin
devvvy16-Apr-11 16:50
devvvy16-Apr-11 16:50 
GeneralRe: LinkedList since .NET 2 Pin
Alan Balkany18-Apr-11 4:07
Alan Balkany18-Apr-11 4:07 
QuestionApplication Crashes during AppDomain.Unload [modified] Pin
Benny_Lava13-Apr-11 3:44
Benny_Lava13-Apr-11 3:44 
Hi,

I have a very strange problem, i have multiple AppDomains (plugin system).

Now at one point i raise an event from one of the plugin domains and the main AppDomain catches the event and calls another function in a seperate thread that Unloads the calling AppDomain.

The first thing that came to my mind is that the plugin domain somehow became the main application domain but it didn't i checked before the culprit line below for AppDomain.FriendlyName and it was different than the main application domain.

code:

private void UnloadDevicePluginDomain(DevicePlugin d)
        {
            Guid id = Guid.NewGuid();

            try {
                lock(locker_) {
                    if(d == null)
                        return;
                    id = d.DevicePluginId;
                    if(d.PluginDomain != null) {
                        //--Just to be on the safe side call plugin Dispose before App domain unload
                        if(d.DeviceInterface != null) {
                            d.DeviceInterface.Dispose();
                        }

                        if(d.WatchDogTimer != null)
                            d.WatchDogTimer.Dispose();

                        d.PluginDomain.UnhandledException -= new UnhandledExceptionEventHandler(DevicePluginCrashed);

                        AppDomain.Unload(d.PluginDomain);   //THE WHOLE APPLICATION CRASHES AT THIS LINE
                        devicePlugins_.Remove(d);
                    }
                }
            } catch (Exception ex) {
               // DOES NOT COME TO THIS PART
            }
        }



So the weird thing is that there is an exception handler and the line nonetheless crashes the whole application.

Any help greatly appreciated.

Thanks.


-- Modified Wednesday, April 13, 2011 3:39 PM

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 
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 

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.