protected bool SendWatsonForAssistantProcess(Exception e, bool killProcessAfterWatson)
        {
            bool result;

            using (Process mailboxAssistantProcess = this.GetMailboxAssistantProcess(this.ExchangeServer.Fqdn))
            {
                if (mailboxAssistantProcess == null)
                {
                    result = false;
                }
                else
                {
                    bool flag = false;
                    if (this.SendCrashDump)
                    {
                        this.crashDumpCount++;
                        ExWatson.SendHangWatsonReport(e, mailboxAssistantProcess);
                        flag = true;
                    }
                    if (killProcessAfterWatson)
                    {
                        this.ForceKillAssistantService(mailboxAssistantProcess);
                    }
                    result = flag;
                }
            }
            return(result);
        }
Ejemplo n.º 2
0
        private void SendWatsonReportForHungService(string serviceName)
        {
            Process process = null;

            try
            {
                process = this.GetProcess(serviceName);
            }
            catch (Win32Exception ex)
            {
                TaskLogger.Log(Strings.UnableToGetProcessForService(serviceName, ex.ToString()));
            }
            if (process == null)
            {
                try
                {
                    process = this.GetFarFetchedProcess(serviceName);
                }
                catch (Win32Exception ex2)
                {
                    TaskLogger.Log(Strings.UnableToGetProcessForService(serviceName, ex2.ToString()));
                }
            }
            if (process != null)
            {
                TaskLogger.Trace("Service {0} has process id {1}", new object[]
                {
                    serviceName,
                    process.Id
                });
                try
                {
                    ExWatson.SendHangWatsonReport(new System.ServiceProcess.TimeoutException(serviceName), process);
                    TaskLogger.Log(Strings.GeneratedWatsonReportForHungService(serviceName));
                }
                catch (Win32Exception ex3)
                {
                    TaskLogger.Log(Strings.UnableToGeneratedWatsonReportForHungService(serviceName, ex3.ToString()));
                }
                catch (InvalidOperationException ex4)
                {
                    TaskLogger.Log(Strings.UnableToGeneratedWatsonReportForHungService(serviceName, ex4.ToString()));
                }
            }
        }