Click here to Skip to main content
15,879,326 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to display the next Record's autonumber in the form? Pin
Anonymous25-Apr-04 2:07
Anonymous25-Apr-04 2:07 
GeneralRegenerate Print Preview Pin
hxxbin23-Apr-04 8:03
hxxbin23-Apr-04 8:03 
GeneralRe: Regenerate Print Preview Pin
Heath Stewart23-Apr-04 10:29
protectorHeath Stewart23-Apr-04 10:29 
GeneralRe: Regenerate Print Preview Pin
hxxbin26-Apr-04 4:14
hxxbin26-Apr-04 4:14 
GeneralMultiple childs of MDI form Pin
turist6923-Apr-04 7:03
turist6923-Apr-04 7:03 
GeneralRe: Multiple childs of MDI form Pin
Heath Stewart23-Apr-04 7:21
protectorHeath Stewart23-Apr-04 7:21 
GeneralRe: Multiple childs of MDI form Pin
turist6923-Apr-04 8:00
turist6923-Apr-04 8:00 
GeneralAppDomain.DomainUnload never fired automatically Pin
VizOne23-Apr-04 6:16
VizOne23-Apr-04 6:16 
Hi!

In my app I'd like to execute some code when an AppDomain is unloaded. I expected AppDomain.DomainUnload to be suitable for this, however the event never gets raised automatically - only if I call AppDomain.Unload with that AppDomain.

Example:
class Class1
{
	static void Main(string[] args)
	{
		// subscribe to current domain
        AppDomain.CurrentDomain.DomainUnload += new EventHandler(CurrentDomain_DomainUnload);		

		// and for testing to another domain:

		AppDomain domain = AppDomain.CreateDomain("Test");
		domain.DomainUnload += new EventHandler(CurrentDomain_DomainUnload);

        // if I uncomment this, the event is fired for 'domain':
		//AppDomain.Unload(domain);
	}

	public static void CurrentDomain_DomainUnload(object sender, EventArgs e)
	{
        Console.WriteLine("Unloading appdomain");
		AppDomain domain = sender as AppDomain;
		if(domain != null)
			Console.WriteLine("... unloading domain is: " + domain.FriendlyName);
	}
}

I find this quite irritating. How can I implement some kind of per-AppDomain shutdown function?

Thanks in advance. Regards,

Andre Loker
GeneralRe: AppDomain.DomainUnload never fired automatically Pin
leppie23-Apr-04 7:00
leppie23-Apr-04 7:00 
GeneralRe: AppDomain.DomainUnload never fired automatically Pin
VizOne25-Apr-04 8:30
VizOne25-Apr-04 8:30 
GeneralP/Invoke and strings Pin
Dominik Reichl23-Apr-04 6:04
Dominik Reichl23-Apr-04 6:04 
GeneralRe: P/Invoke and strings Pin
Heath Stewart23-Apr-04 6:11
protectorHeath Stewart23-Apr-04 6:11 
QuestionMultithreaded shared remote object ? Pin
Gangren23-Apr-04 5:50
Gangren23-Apr-04 5:50 
AnswerRe: Multithreaded shared remote object ? Pin
Heath Stewart23-Apr-04 6:14
protectorHeath Stewart23-Apr-04 6:14 
GeneralRe: Multithreaded shared remote object ? Pin
Gangren23-Apr-04 6:24
Gangren23-Apr-04 6:24 
GeneralRe: Multithreaded shared remote object ? Pin
Heath Stewart23-Apr-04 6:35
protectorHeath Stewart23-Apr-04 6:35 
GeneralRe: Multithreaded shared remote object ? Pin
Tom Larsen23-Apr-04 10:06
Tom Larsen23-Apr-04 10:06 
GeneralRe: Multithreaded shared remote object ? Pin
Gangren23-Apr-04 12:59
Gangren23-Apr-04 12:59 
GeneralRe: Multithreaded shared remote object ? Pin
Tom Larsen29-Apr-04 11:07
Tom Larsen29-Apr-04 11:07 
GeneralRe: Multithreaded shared remote object ? Pin
Gangren29-Apr-04 11:22
Gangren29-Apr-04 11:22 
AnswerRe: Multithreaded shared remote object ? Pin
Gangren27-Apr-04 20:00
Gangren27-Apr-04 20:00 
GeneralPrint Preview Pin
GoodQuestion23-Apr-04 5:18
GoodQuestion23-Apr-04 5:18 
GeneralRe: Print Preview Pin
Heath Stewart23-Apr-04 6:09
protectorHeath Stewart23-Apr-04 6:09 
GeneralRe: Print Preview Pin
GoodQuestion27-Apr-04 11:21
GoodQuestion27-Apr-04 11:21 
GeneralDataGrids used for simple data Pin
Jon G23-Apr-04 4:45
Jon G23-Apr-04 4:45 

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.