internal static void RemoveThisAppDomainFromUnmanagedTable()
        {
            if (Interlocked.Exchange(ref s_isThisAppDomainRemovedFromUnmanagedTable, 1) != 0)
            {
                return;
            }

            //
            // only notify mgdeng of this shutdown if we went through
            // Initialize from the there
            // We can also have PipelineRuntime in app domains with only
            // other protocols
            //
            try {
                if (s_thisAppDomainsIsapiAppId != null && s_ApplicationContext != IntPtr.Zero)
                {
                    Debug.Trace("PipelineDomain", "Calling MgdAppDomainShutdown appId=" +
                                s_thisAppDomainsIsapiAppId + " (AppDomainAppId=" + HttpRuntime.AppDomainAppId + ")");

                    UnsafeIISMethods.MgdAppDomainShutdown(s_ApplicationContext);
                }

                HttpRuntime.AddAppDomainTraceMessage(SR.GetString(SR.App_Domain_Restart));
            }
            catch (Exception e) {
                if (ShouldRethrowException(e))
                {
                    throw;
                }
            }
        }
 internal static void RemoveThisAppDomainFromUnmanagedTable()
 {
     if (Interlocked.Exchange(ref s_isThisAppDomainRemovedFromUnmanagedTable, 1) == 0)
     {
         try
         {
             if ((s_thisAppDomainsIsapiAppId != null) && (s_ApplicationContext != IntPtr.Zero))
             {
                 UnsafeIISMethods.MgdAppDomainShutdown(s_ApplicationContext);
             }
             HttpRuntime.AddAppDomainTraceMessage(System.Web.SR.GetString("App_Domain_Restart"));
         }
         catch (Exception exception)
         {
             if (ShouldRethrowException(exception))
             {
                 throw;
             }
         }
     }
 }