473,399 Members | 3,603 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Why is DomainUnload not raised for the default AppDomain

Hi,

Does anyone know why the DomainUnload is not raised for the default
AppDomain.

I'm trying to get some shutdown code in a dynamically loaded assembly
called before the application shuts down.

I tried adding a handler for the DomainUnload event to the
AppDomain.CurrentDomain, but this does not get raised because it is the
default Domain.

Can anyone suggest an alternative?

I can't use a Finalizer as I have no control over the order in which
objects are disposed and could result in the shutdown code failing.
Also the hosting application has no reference to the loaded assembly.

Basically, I need a way for the assembly to know when it is about to be
unloaded.

Thanks,
John

Jun 12 '06 #1
2 3577
By the time the DomainUnload event happens for your default app domain, your
code has stopped executing. You can probably do what you need to with the
ProcessExit event on the default AppDomain.

"JohnH" wrote:
Hi,

Does anyone know why the DomainUnload is not raised for the default
AppDomain.

I'm trying to get some shutdown code in a dynamically loaded assembly
called before the application shuts down.

I tried adding a handler for the DomainUnload event to the
AppDomain.CurrentDomain, but this does not get raised because it is the
default Domain.

Can anyone suggest an alternative?

I can't use a Finalizer as I have no control over the order in which
objects are disposed and could result in the shutdown code failing.
Also the hosting application has no reference to the loaded assembly.

Basically, I need a way for the assembly to know when it is about to be
unloaded.

Thanks,
John

Jun 12 '06 #2
Thanks Casey,

I don't know how I missed that event

John

Jun 12 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Sean Hederman | last post by:
I've got a couple of things I'm not sure in my mind about as far as the options to CorBindToRuntimeEx go: 1. Is the default option for Windows Forms is...
2
by: Martin Lapierre | last post by:
How can I remove the default exception handler handler? When adding a custom handler, I can't get rid of the VS.NET unhandled exception dialog. Ex: AppDomain currentDomain =...
8
by: Bern McCarty | last post by:
Is it at all possible to leverage mixed-mode assemblies from AppDomains other than the default AppDomain? Is there any means at all of doing this? Mixed-mode is incredibly convenient, but if I...
0
by: Daylor | last post by:
hi. how can i set the AppDomain.BaseDirectory to the default appdomain ? (i dont want /need to create new appdomain )
4
by: Andy | last post by:
Hi, I was wondering if it was possible to get the Entry assembly for the default application domain (and how to determine what the default app domain is..). I'd like to get to it for logging...
2
by: Dave Burns | last post by:
Hello, We have a situation where a managed C++ assembly links with native C++ dll. There is a callback mechanism which calls back into the managed code asynchronously. Since native classes...
0
by: =?Utf-8?B?SmltIFdhbHNo?= | last post by:
I have a mixed assembly. Visual C++/MFC and a .NET C# Windows Form User Control to be used in an MFC dialog box. Most of the modules in the Visual C++/MFC part of the project are...
2
by: siger99 | last post by:
Hi, I try to use a 3rd party assembly ( basically a layer of managed C++ around a native C++ lib). Unfortunately, it was developped for NET 1.1 and knows only the default AppDomain. When I...
0
by: Paul E Collins | last post by:
We use CSharpCodeProvider to create and execute an assembly at run-time. This is done over and over, and we have started to get memory leaks. I found an explanation in this article (under "Assembly...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.