Click here to Skip to main content
15,888,351 members
Home / Discussions / C#
   

C#

 
GeneralRe: Creating a database manager Pin
Heath Stewart23-Apr-04 15:56
protectorHeath Stewart23-Apr-04 15:56 
GeneralPassing a Class instance to a method... Pin
hammackj23-Apr-04 10:38
hammackj23-Apr-04 10:38 
GeneralRe: Passing a Class instance to a method... Pin
Heath Stewart23-Apr-04 10:41
protectorHeath Stewart23-Apr-04 10:41 
GeneralRe: Passing a Class instance to a method... Pin
hammackj23-Apr-04 10:51
hammackj23-Apr-04 10:51 
GeneralRe: Passing a Class instance to a method... Pin
Werdna23-Apr-04 16:32
Werdna23-Apr-04 16:32 
GeneralRe: Passing a Class instance to a method... Pin
Heath Stewart24-Apr-04 8:14
protectorHeath Stewart24-Apr-04 8:14 
GeneralDrawString strange problem Pin
_Comet_Keeper_23-Apr-04 10:20
_Comet_Keeper_23-Apr-04 10:20 
GeneralRe: DrawString strange problem Pin
Heath Stewart23-Apr-04 10:45
protectorHeath Stewart23-Apr-04 10:45 
QuestionHow can I do Word Wrap in ListBox Items Pin
BinalShah23-Apr-04 10:12
BinalShah23-Apr-04 10:12 
AnswerRe: How can I do Word Wrap in ListBox Items Pin
Heath Stewart23-Apr-04 10:38
protectorHeath Stewart23-Apr-04 10:38 
QuestionHow to cut video to images by C# Pin
MDM_RVS23-Apr-04 8:25
MDM_RVS23-Apr-04 8:25 
AnswerRe: How to cut video to images by C# Pin
Heath Stewart23-Apr-04 10:34
protectorHeath Stewart23-Apr-04 10:34 
QuestionHow to display the next Record's autonumber in the form? Pin
Anonymous23-Apr-04 8:07
Anonymous23-Apr-04 8:07 
AnswerRe: How to display the next Record's autonumber in the form? Pin
Heath Stewart23-Apr-04 10:31
protectorHeath Stewart23-Apr-04 10:31 
GeneralRe: How to display the next Record's autonumber in the form? Pin
Anonymous23-Apr-04 23:50
Anonymous23-Apr-04 23:50 
GeneralRe: How to display the next Record's autonumber in the form? Pin
Heath Stewart24-Apr-04 8:12
protectorHeath Stewart24-Apr-04 8:12 
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 

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.