title: Unload event for the default Application Domain?
body: <p>Is there an <em>Unload</em> event, or <em>any</em> event, notification, message, mechanism, or hook, that i can use to be notified before the <em>"default"</em> application domain is unloaded?</p>
  
  <p>i have code that needs to know when the application domain (almost always the default domain) is ending.</p>
  
  <p>Note: i don't know what kind of application a developer will be creating when he uses my code. It could be:</p>
  
  <ul>
  <li>a console application</li>
  <li>a WinForms application</li>
  <li>an ASP.net application</li>
  <li>an ASP.net web-site</li>
  <li>Runtime Callable Wrapper (RCW) COM object</li>
  <li>a Windows Explorer shell extension</li>
  <li>or a Windows Service</li>
  </ul>
  
  <p>Either way, i need to know when the domain is closing, so i can do some <em>"stuff"</em>. And i am not going to require the user to call any sort of <em>"Shutdown"</em> or <em>"Cleanup"</em> method. (Also, suggesting that the user be required to call a method themselves doesn't answer the question: which is about being notified when the app domain i'm running in is shut down).</p>
  
  <h2>See also</h2>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/4549787/unload-event-for-the-default-appdomain">Unload event for the default AppDomain?</a></li>
  <li><a href="https://stackoverflow.com/questions/18020861/when-to-cleanup-static-variables">How to get notified before static variables are finalized</a></li>
  </ul>