AppDomain.ProcessExit event not fired in Internet Explorer

  • Thread starter Thread starter Olivier R
  • Start date Start date
O

Olivier R

Hello,

My configuration :
Windows XP
Internet Explorer 6
..NET Framework 1.0
Visual Studio .NET 2002


The symptoms:
I have created a class which registers a handler for the
AppDomain.ProcessExit event (say this is done in a static method Class.Init()).

Case 1:
Class hosted in a Windows Application :
The handler is called when I close the Windows Application.

Case 2:
Class hosted in Internet Explorer :
The handler is not called when I close Internet Explorer !!
(I obviously checked that Class.Init() had been called).

Can someone help me ??
Thanks !
 
Hello,

I think it's because the process itself (in this case the iexplore.exe that
hosts the CLR) does not actually exit.
 
I don't agree with you.
I checked that the internet explorer process instance exits since
it disappears from the list of the tasks in the task manager or there
is something wrong with my eyes ?

Dmitriy Lapshin said:
Hello,

I think it's because the process itself (in this case the iexplore.exe that
hosts the CLR) does not actually exit.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

Olivier R said:
Hello,

My configuration :
Windows XP
Internet Explorer 6
.NET Framework 1.0
Visual Studio .NET 2002


The symptoms:
I have created a class which registers a handler for the
AppDomain.ProcessExit event (say this is done in a static method Class.Init()).

Case 1:
Class hosted in a Windows Application :
The handler is called when I close the Windows Application.

Case 2:
Class hosted in Internet Explorer :
The handler is not called when I close Internet Explorer !!
(I obviously checked that Class.Init() had been called).

Can someone help me ??
Thanks !
 
Does it disappear from the list of the tasks or from the list of processes?
This difference is important. If it disappears from the list of processes,
then my only suggestion would be that the AppDomain is not given a chance to
uninitialize properly and therefore it cannot raise the event in question.

Another guess after reading the corresponding MSDN topic - security
permissions (CLR hosted in IE runs managed code with rather tight security
restrictions) can affect raising this event. This seems strange to me, as
you wouldn't then be able to subscribe to that event in the first place.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

Olivier R said:
I don't agree with you.
I checked that the internet explorer process instance exits since
it disappears from the list of the tasks in the task manager or there
is something wrong with my eyes ?

"Dmitriy Lapshin [C# / .NET MVP]" <[email protected]> wrote
in message news: said:
Hello,

I think it's because the process itself (in this case the iexplore.exe that
hosts the CLR) does not actually exit.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

Olivier R said:
Hello,

My configuration :
Windows XP
Internet Explorer 6
.NET Framework 1.0
Visual Studio .NET 2002


The symptoms:
I have created a class which registers a handler for the
AppDomain.ProcessExit event (say this is done in a static method Class.Init()).

Case 1:
Class hosted in a Windows Application :
The handler is called when I close the Windows Application.

Case 2:
Class hosted in Internet Explorer :
The handler is not called when I close Internet Explorer !!
(I obviously checked that Class.Init() had been called).

Can someone help me ??
Thanks !
 
Dmitriy Lapshin said:
Does it disappear from the list of the tasks or from the list of processes?
Excuse me, I hadn't been clear enough.
The IEXPLORE.EXE process disappears from the list of processes.
This difference is important. If it disappears from the list of processes,
then my only suggestion would be that the AppDomain is not given a chance to
uninitialize properly and therefore it cannot raise the event in question.
I agree with you on this potential cause.
Another guess after reading the corresponding MSDN topic - security
permissions (CLR hosted in IE runs managed code with rather tight security
restrictions) can affect raising this event. This seems strange to me, as
you wouldn't then be able to subscribe to that event in the first place.
I forgot to mention that I'm logged as local administrator and that I
enabled
full code access for my assembly on my local machine.

Another interesting thing is that I can register
an UnhandledExceptionEventHandler without any exception being thrown.
However, my routine is not called when an unhandled exception is
thrown.
Instead, this is the CLR routine that is called.
The event is not fired.
This leads me to think that in this case, the event registration
REALLY failed !
But I expected that after my reading on an excellent article on MSDN :
"Return of the Rich client".

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

Olivier R said:
I don't agree with you.
I checked that the internet explorer process instance exits since
it disappears from the list of the tasks in the task manager or there
is something wrong with my eyes ?

"Dmitriy Lapshin [C# / .NET MVP]" <[email protected]> wrote
in message news: said:
Hello,

I think it's because the process itself (in this case the iexplore.exe that
hosts the CLR) does not actually exit.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

Hello,

My configuration :
Windows XP
Internet Explorer 6
.NET Framework 1.0
Visual Studio .NET 2002


The symptoms:
I have created a class which registers a handler for the
AppDomain.ProcessExit event (say this is done in a static method Class.Init()).

Case 1:
Class hosted in a Windows Application :
The handler is called when I close the Windows Application.

Case 2:
Class hosted in Internet Explorer :
The handler is not called when I close Internet Explorer !!
(I obviously checked that Class.Init() had been called).

Can someone help me ??
Thanks !
 
Back
Top