internal static void WriteUnhandledExceptionToEventLog(AppDomain appDomain, Exception exception) { if ((appDomain != null) && (exception != null)) { ProcessImpersonationContext context = null; try { context = new ProcessImpersonationContext(); string data = appDomain.GetData(".appId") as string; if (data == null) { data = appDomain.FriendlyName; } string str2 = System.Web.SafeNativeMethods.GetCurrentProcessId().ToString(CultureInfo.InstalledUICulture); string str3 = System.Web.SR.Resources.GetString("Unhandled_Exception", CultureInfo.InstalledUICulture); ReportUnhandledException(exception, new string[] { str3, "\r\n\r\nApplication ID: ", data, "\r\n\r\nProcess ID: ", str2 }); } catch { } finally { if (context != null) { context.Undo(); } } } }