Esempio n. 1
0
        internal static void WriteUnhandledExceptionToEventLog(AppDomain appDomain, Exception exception)
        {
            if (appDomain == null || exception == null)
            {
                return;
            }

            ProcessImpersonationContext imperContext = null;

            try {
                imperContext = new ProcessImpersonationContext();
                String appId = appDomain.GetData(".appId") as String;
                if (appId == null)
                {
                    appId = appDomain.FriendlyName;
                }
                string pid         = SafeNativeMethods.GetCurrentProcessId().ToString(CultureInfo.InstalledUICulture);
                string description = SR.Resources.GetString(SR.Unhandled_Exception, CultureInfo.InstalledUICulture);
                Misc.ReportUnhandledException(exception, new string[5] {
                    description, APPLICATION_ID, appId, PROCESS_ID, pid
                });
            }
            catch {
                // ignore exceptions so that WriteErrorToEventLog never throws
            }
            finally {
                if (imperContext != null)
                {
                    imperContext.Undo();
                }
            }
        }
Esempio n. 2
0
        internal static void WriteUnhandledExceptionToEventLog(AppDomain appDomain, Exception exception) {
            if (appDomain == null || exception == null) {
                return;
            }

            ProcessImpersonationContext imperContext = null;
            try {
                imperContext = new ProcessImpersonationContext();
                String appId = appDomain.GetData(".appId") as String;
                if (appId == null) {
                    appId = appDomain.FriendlyName;
                }
                string pid = SafeNativeMethods.GetCurrentProcessId().ToString(CultureInfo.InstalledUICulture);
                string description = SR.Resources.GetString(SR.Unhandled_Exception, CultureInfo.InstalledUICulture);
                Misc.ReportUnhandledException(exception, new string[5] {description, APPLICATION_ID, appId, PROCESS_ID, pid});
            }
            catch {
                // ignore exceptions so that WriteErrorToEventLog never throws
            }
            finally {
                if (imperContext != null) {
                    imperContext.Undo();
                }
            }
        }
Esempio n. 3
0
 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();
             }
         }
     }
 }