When an AppDomain instance is shut down or unloaded, an AppDomainShutdown event or an AppDomainUnloaded event is raised, respectively. The BuildManagerHostUnloadEventArgs object stores the reason for the shutdown or unload and is passed to the event handler as one of its parameters.