Beispiel #1
0
        // Token: 0x06000001 RID: 1 RVA: 0x000020D0 File Offset: 0x000002D0
        public static void Main(string[] args)
        {
            List <string> list = new List <string>();

            list.Add("SeAuditPrivilege");
            list.Add("SeChangeNotifyPrivilege");
            list.Add("SeCreateGlobalPrivilege");
            list.Add("SeImpersonatePrivilege");
            bool isSystem;

            using (WindowsIdentity current = WindowsIdentity.GetCurrent())
            {
                isSystem = current.IsSystem;
            }
            if (isSystem)
            {
                list.Add("SeIncreaseQuotaPrivilege");
                list.Add("SeAssignPrimaryTokenPrivilege");
            }
            int num = Privileges.RemoveAllExcept(list.ToArray());

            if (num != 0)
            {
                Program.main.StopService(Strings.PrivilegeRemovalFailure(num), true, false, false);
            }
            ExWatson.Init();
            AppDomain.CurrentDomain.UnhandledException += Program.MainUnhandledExceptionHandler;
            if (!Program.AddTokenReadPermissionForAdminGroup())
            {
                ExTraceGlobals.GeneralTracer.TraceDebug(0L, "Failed to update the process security descriptor with TOKEN_READ. The result is the managed debugger may fail to attach.");
            }
            Program.main.Run(args);
            Program.Exit(Program.main.immediateRetryAfterExit ? 200 : 0);
        }
Beispiel #2
0
 internal static void UpdateSearchObject(IDiscoverySearchDataProvider dataProvider, DiscoverySearchBase searchObject)
 {
     ExWatson.SendReportOnUnhandledException(delegate()
     {
         try
         {
             GrayException.MapAndReportGrayExceptions(delegate()
             {
                 dataProvider.CreateOrUpdate <DiscoverySearchBase>(searchObject);
             });
         }
         catch (DataSourceOperationException ex)
         {
             ExTraceGlobals.SearchTracer.TraceError <string, string>(0L, "UpdateSearchObject:Update Search failed for {0}. Root cause: {1}", searchObject.Name, ex.ToString());
             SearchEventLogger.Instance.LogDiscoverySearchTaskErrorEvent(searchObject.Name, dataProvider.OrganizationId.ToString(), ex);
         }
         catch (GrayException ex2)
         {
             ExTraceGlobals.SearchTracer.TraceError <GrayException>(0L, "UpdateSearchObject: GrayException {0} is thrown", ex2);
             SearchEventLogger.Instance.LogDiscoverySearchTaskErrorEvent(searchObject.Name, dataProvider.OrganizationId.ToString(), ex2);
         }
     }, delegate(object exception)
     {
         ExTraceGlobals.SearchTracer.TraceError(0L, "UpdateSearchObject: Unhandled exception {0}", new object[]
         {
             exception
         });
         SearchEventLogger.Instance.LogDiscoverySearchTaskErrorEvent(searchObject.Name, dataProvider.OrganizationId.ToString(), exception.ToString());
         return(!(exception is GrayException));
     });
 }
 // Token: 0x06007276 RID: 29302 RVA: 0x0017B2BC File Offset: 0x001794BC
 private CostHandle(Budget budget, Action <CostHandle> releaseAction, string description, TimeSpan preCharge)
 {
     if (budget == null)
     {
         throw new ArgumentNullException("budget");
     }
     if (string.IsNullOrEmpty(description))
     {
         ExWatson.SendReport(new ArgumentNullException("cost handle description is null or empty"), ReportOptions.DoNotCollectDumps | ReportOptions.DeepStackTraceHash, null);
     }
     if (preCharge < TimeSpan.Zero)
     {
         throw new ArgumentException("preCharge cannot be a negative timespan", "preCharge");
     }
     this.Budget        = budget;
     this.Key           = Interlocked.Increment(ref CostHandle.nextKey);
     this.StartTime     = TimeProvider.UtcNow - preCharge;
     this.PreCharge     = preCharge;
     this.ReleaseAction = releaseAction;
     this.Budget.AddOutstandingAction(this);
     this.DisposedByThread = -1;
     this.DisposedAt       = DateTime.MinValue;
     this.Description      = description;
     this.MaxLiveTime      = Budget.GetMaxActionTime(this.CostType);
 }
Beispiel #4
0
        // Token: 0x0600031F RID: 799 RVA: 0x0000D79C File Offset: 0x0000B99C
        public static void AssertOrWatson(bool condition, string formatString, params object[] parameters)
        {
            if (condition)
            {
                return;
            }
            StringBuilder stringBuilder = new StringBuilder("ASSERT_WATSON: ");

            if (formatString != null)
            {
                if (parameters != null)
                {
                    stringBuilder.AppendFormat(CultureInfo.InvariantCulture, formatString, parameters);
                }
                else
                {
                    stringBuilder.Append(formatString);
                }
            }
            string text = stringBuilder.ToString();

            ExTraceGlobals.ReplayApiTracer.TraceError <string>(0L, "AssertOrWatson: Sending Watson report. {0}", text);
            Exception exception = null;

            try
            {
                throw new ExAssertException(text);
            }
            catch (ExAssertException ex)
            {
                exception = ex;
            }
            ExWatson.SendReport(exception, ReportOptions.None, "AssertOrWatson");
        }
 internal void Process(HttpContext context)
 {
     ExTraceGlobals.WebHealthTracer.TraceDebug((long)this.GetHashCode(), "ExWebTimeoutReportHandler::ProcessHealth()");
     try
     {
         if (ExMonitoringRequestTracker.Instance.IsKnownMonitoringRequest(context.Request))
         {
             context.Response.StatusCode = 200;
         }
         else
         {
             context.Response.StatusCode = 403;
         }
     }
     catch (Exception ex)
     {
         Exception ex2;
         Exception ex = ex2;
         ExTraceGlobals.WebHealthTracer.TraceError <Exception>((long)this.GetHashCode(), "ExWebTimeoutReportHandler::Process encountered error {0}", ex);
         ThreadPool.QueueUserWorkItem(delegate(object o)
         {
             ExWatson.SendReport(ex, ReportOptions.DoNotCollectDumps | ReportOptions.DoNotFreezeThreads, string.Empty);
         });
     }
 }
        private void ForwardKnownExceptions(Action operation, Func <Exception, bool> ignoreExceptionOperation = null)
        {
            Exception failure = null;

            try
            {
                CommonUtils.CatchKnownExceptions(operation, delegate(Exception f)
                {
                    failure = f;
                });
            }
            catch (Exception ex)
            {
                MrsTracer.Service.Error("Unhandled exception in MRS:\n{0}\n{1}", new object[]
                {
                    CommonUtils.FullExceptionMessage(ex),
                    ex.StackTrace
                });
                ExWatson.SendReport(ex);
                throw;
            }
            if (failure != null && (ignoreExceptionOperation == null || !ignoreExceptionOperation(failure)))
            {
                MailboxReplicationServiceFault.Throw(failure);
            }
        }
Beispiel #7
0
 private void reportButton_Click(object sender, EventArgs e)
 {
     using (new ControlWaitCursor(this))
     {
         ExWatson.SendReport(this.Exception);
     }
 }
Beispiel #8
0
        internal static bool CatchNonFatalExceptions(Action action, string diagnosticsDataToLog = null)
        {
            bool result = false;

            try
            {
                action();
            }
            catch (Exception ex)
            {
                if (ex is OutOfMemoryException || ex is StackOverflowException || ex is ThreadAbortException)
                {
                    throw;
                }
                result = true;
                diagnosticsDataToLog = (diagnosticsDataToLog ?? string.Empty);
                if (!(ex is StoragePermanentException) && !(ex is StorageTransientException))
                {
                    ReportOptions options = ActivityLoggingConfig.Instance.IsDumpCollectionEnabled ? ReportOptions.None : ReportOptions.DoNotCollectDumps;
                    ExWatson.SendReport(ex, options, diagnosticsDataToLog);
                }
                InferenceDiagnosticsLog.Log("CatchNonFatalExceptions", new List <string>
                {
                    diagnosticsDataToLog,
                    ex.ToString()
                });
            }
            return(result);
        }
Beispiel #9
0
        public void DisposePendingNotificationClientRequest()
        {
            if (base.OwaContext.UserContext == null)
            {
                return;
            }
            this.pendingManager = base.OwaContext.UserContext.PendingRequestManager;
            object parameter = base.GetParameter("Fn");

            if (parameter != null)
            {
                bool flag = (bool)parameter;
            }
            int num = 0;

            try
            {
                base.UserContext.DangerousBeginUnlockedAction(false, out num);
                if (num != 1)
                {
                    ExWatson.SendReport(new InvalidOperationException("Thread held more than 1 lock in DisposePendingNotificationClientRequest method."), ReportOptions.None, null);
                }
                bool         flag2        = this.pendingManager.HandleFinishRequestFromClient();
                HttpResponse httpResponse = base.OwaContext.HttpContext.Response;
                httpResponse.Write("var syncFnshRq = ");
                httpResponse.Write(flag2 ? "1" : "0");
                httpResponse.AppendHeader("X-OWA-EventResult", "0");
                Utilities.MakePageNoCacheNoStore(httpResponse);
                httpResponse.ContentType = Utilities.GetContentTypeString(base.ResponseContentType);
            }
            finally
            {
                base.UserContext.DangerousEndUnlockedAction(false, num);
            }
        }
Beispiel #10
0
 internal static void SendInstantMessageWatsonReport(IUserContext userContext, Exception exception)
 {
     Microsoft.Exchange.Clients.Owa.Server.LyncIMLogging.ExTraceGlobals.InstantMessagingTracer.TraceDebug(0L, "Exception: Type: {0} Error: {1}.", new object[]
     {
         exception.GetType(),
         exception.Message
     });
     if (Globals.SendWatsonReports)
     {
         Microsoft.Exchange.Clients.Owa.Server.LyncIMLogging.ExTraceGlobals.InstantMessagingTracer.TraceDebug(0L, "Sending watson report");
         ReportOptions options = (exception is AccessViolationException || exception is InvalidProgramException || exception is TypeInitializationException) ? ReportOptions.ReportTerminateAfterSend : ReportOptions.None;
         ExWatson.AddExtraData(InstantMessageUtilities.GetExtraWatsonData(userContext));
         ExWatson.SendReport(exception, options, null);
     }
     if (exception is AccessViolationException)
     {
         Microsoft.Exchange.Clients.Owa.Server.LyncIMLogging.ExTraceGlobals.InstantMessagingTracer.TraceDebug(0L, "Shutting down OWA due to unrecoverable exception");
         ErrorHandlerUtilities.TerminateProcess();
         return;
     }
     if ((exception is InvalidProgramException || exception is TypeInitializationException) && Interlocked.Exchange(ref InstantMessageUtilities.queuedDelayedRestart, 1) == 0)
     {
         new Thread(new ThreadStart(InstantMessageUtilities.DelayedRestartUponUnexecutableCode)).Start();
     }
 }
Beispiel #11
0
 internal static void UserContextRemovedCallback(string key, object value, CacheItemRemovedReason reason)
 {
     try
     {
     }
     finally
     {
         try
         {
             UserContextManager.UserContextCacheWrapper userContextCacheWrapper = value as UserContextManager.UserContextCacheWrapper;
             if (userContextCacheWrapper.UserContext != null)
             {
                 ExTraceGlobals.UserContextTracer.TraceDebug <string, UserContext, int>(0L, "Removing user context from cache, Key={0}, User context instance={1}, Reason={2}", key, userContextCacheWrapper.UserContext, (int)reason);
                 UserContextManager.TerminateSession(userContextCacheWrapper.UserContext, reason);
             }
         }
         catch (ThreadAbortException)
         {
         }
         catch (Exception exception)
         {
             if (Globals.SendWatsonReports)
             {
                 ExTraceGlobals.CoreTracer.TraceDebug(0L, "Sending watson report");
                 ExWatson.SendReport(exception, ReportOptions.None, null);
             }
         }
     }
 }
Beispiel #12
0
        public static void FailFast(string message, bool alwaysTerminate)
        {
            bool flag = ExDiagnostics.FailFastMode != FailFastMode.Exception && ExDiagnostics.FailFastMode != FailFastMode.Test;

            flag = (flag || alwaysTerminate);
            try
            {
                ExDiagnostics.failFastEventHandlers(flag);
            }
            catch
            {
            }
            if (ExDiagnostics.FailFastMode == FailFastMode.Test && !flag)
            {
                throw new TestFailFastException(message);
            }
            FailFastException ex = new FailFastException(message, new StackTrace(1, true).ToString());

            ExWatson.SendReport(ex);
            if (flag)
            {
                Environment.Exit(1);
                return;
            }
            throw ex;
        }
 public static CancelableAsyncCallback WrapCancellableCallbackWithUnhandledExceptionHandlerAndUpdatePoisonContext(CancelableAsyncCallback callback)
 {
     if (callback == null)
     {
         return(null);
     }
     return(delegate(ICancelableAsyncResult asyncResult)
     {
         RightsManagementAsyncResult asyncResultRM = null;
         if (asyncResult != null && asyncResult.AsyncState != null)
         {
             asyncResultRM = (asyncResult.AsyncState as RightsManagementAsyncResult);
         }
         try
         {
             if (asyncResultRM != null)
             {
                 asyncResultRM.InvokeSaveContextCallback();
             }
             callback(asyncResult);
         }
         catch (Exception exception)
         {
             ExWatson.SendReportAndCrashOnAnotherThread(exception, ReportOptions.None, delegate(Exception param0, int param1)
             {
                 if (asyncResultRM != null)
                 {
                     asyncResultRM.InvokeSaveContextCallback();
                 }
             }, null);
             throw;
         }
     });
 }
        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);
        }
Beispiel #15
0
 internal override object this[PropertyDefinition propertyDefinition]
 {
     get
     {
         object result;
         try
         {
             result = base[propertyDefinition];
         }
         catch (ArgumentException)
         {
             ExWatson.AddExtraData(string.Format("\r\nthis.Identity = {0}\r\nthis.ObjectState = {1}\r\nthis.IsReadOnly = {2}\r\nthis.session = {3}\r\nthis.session.ReadOnly = {4}\r\nthis.propertyBag.Keys.Count = {5}\r\nthis.ObjectSchema.AllProperties.Count = {6}\r\n", new object[]
             {
                 this.Identity,
                 base.ObjectState,
                 base.IsReadOnly,
                 (this.m_Session == null) ? "<null>" : this.m_Session.ToString(),
                 (this.m_Session == null) ? "<null>" : this.m_Session.ReadOnly.ToString(),
                 this.propertyBag.Keys.Count,
                 this.Schema.AllProperties.Count
             }));
             ExWatson.AddExtraData("this.propertyBag.Keys = " + ADObject.CollectionToString(this.propertyBag.Keys));
             ExWatson.AddExtraData("this.Schema.AllProperties = " + ADObject.CollectionToString(this.Schema.AllProperties));
             throw;
         }
         return(result);
     }
     set
     {
         base[propertyDefinition] = value;
     }
 }
Beispiel #16
0
        private static void WatsonThreadProc(object stateInfo)
        {
            Thread.CurrentThread.IsBackground = false;
            DisposeTrackerObject <T> .WatsonThreadStateInfo watsonThreadStateInfo = (DisposeTrackerObject <T> .WatsonThreadStateInfo)stateInfo;
            string text = DisposeTrackerObject <T> .StackTraceToString(watsonThreadStateInfo.StackTrace);

            if (text != null)
            {
                ObjectNotDisposedException <T> exception = new ObjectNotDisposedException <T>(text, watsonThreadStateInfo.StackTraceWasReset);
                try
                {
                    if (watsonThreadStateInfo.ExtraDataList != null)
                    {
                        foreach (WatsonExtraDataReportAction action in watsonThreadStateInfo.ExtraDataList)
                        {
                            ExWatson.RegisterReportAction(action, WatsonActionScope.Thread);
                        }
                    }
                    ExWatson.HandleException(new UnhandledExceptionEventArgs(exception, DisposeTrackerOptions.TerminateOnReport), ReportOptions.DoNotCollectDumps | ReportOptions.DeepStackTraceHash | ReportOptions.DoNotLogProcessAndThreadIds | ReportOptions.DoNotFreezeThreads);
                }
                finally
                {
                    if (watsonThreadStateInfo.ExtraDataList != null)
                    {
                        foreach (WatsonExtraDataReportAction action2 in watsonThreadStateInfo.ExtraDataList)
                        {
                            ExWatson.UnregisterReportAction(action2, WatsonActionScope.Thread);
                        }
                    }
                }
            }
            Thread.CurrentThread.IsBackground = true;
        }
Beispiel #17
0
 public override byte[] Notify(int version, int type, byte[] inputParameterBytes)
 {
     byte[] result2;
     try
     {
         using (new Timer(new TimerCallback(RpcServerWrapper.CrashOnCallTimeout), Thread.CurrentThread, RpcServerWrapper.notifyRequestTimeout, TimeSpan.FromMilliseconds(-1.0)))
         {
             WorkItemBase           workItem = WorkItemBase.Deserialize(inputParameterBytes);
             SyncNotificationResult result   = null;
             try
             {
                 WorkItemBase workItem2 = SyncManager.EnqueueWorkItem(workItem);
                 result = new SyncNotificationResult(UnifiedPolicyNotificationFactory.Create(workItem2, new ADObjectId()));
             }
             catch (SyncAgentExceptionBase error)
             {
                 result = new SyncNotificationResult(error);
             }
             NotificationRpcOutParameters notificationRpcOutParameters = new NotificationRpcOutParameters(result);
             result2 = notificationRpcOutParameters.Serialize();
         }
     }
     catch (Exception ex)
     {
         ExWatson.SendReport(ex, ReportOptions.None, null);
         NotificationRpcOutParameters notificationRpcOutParameters = new NotificationRpcOutParameters(new SyncNotificationResult(ex));
         result2 = notificationRpcOutParameters.Serialize();
     }
     return(result2);
 }
Beispiel #18
0
 // Token: 0x06000009 RID: 9 RVA: 0x000026C8 File Offset: 0x000008C8
 private static void LogStage(MailboxTransportDeliveryService.Stage stage)
 {
     MailboxTransportDeliveryService.stage      = stage;
     MailboxTransportDeliveryService.logData[0] = new KeyValuePair <string, object>("Stage", stage.ToString());
     CommonDiagnosticsLog.Instance.LogEvent(CommonDiagnosticsLog.Source.MailboxDeliveryService, MailboxTransportDeliveryService.logData);
     ExWatson.AddExtraData(string.Format("{0:u}: Stage={1}", DateTime.UtcNow, stage));
 }
Beispiel #19
0
 public void SendReportOnUnhandledException(Action action)
 {
     ExWatson.SendReportOnUnhandledException(delegate()
     {
         action();
     });
 }
Beispiel #20
0
        // Token: 0x0600000A RID: 10 RVA: 0x00002730 File Offset: 0x00000930
        private static void MainUnhandledExceptionHandler(object sender, UnhandledExceptionEventArgs eventArgs)
        {
            MailboxTransportDeliveryService.diag.TraceDebug(0L, "MainUnhandledExceptionHandler");
            if (MailboxTransportDeliveryService.isExiting)
            {
                Environment.Exit(0);
            }
            if (Components.IsActive)
            {
                Components.OnUnhandledException((Exception)eventArgs.ExceptionObject);
                PoisonMessage.SavePoisonContext((Exception)eventArgs.ExceptionObject);
                DeliveryConfiguration.Instance.PoisonHandler.SavePoisonContext();
                MailboxTransportEventLogger.LogEvent(MSExchangeDeliveryEventLogConstants.Tuple_DeliveryPoisonMessage, null, new string[]
                {
                    PoisonHandler <DeliveryPoisonContext> .Context.ToString(),
                    eventArgs.ExceptionObject.ToString()
                });
            }
            int num = Interlocked.Exchange(ref MailboxTransportDeliveryService.busyUnhandledException, 1);

            if (num == 1)
            {
                return;
            }
            ExWatson.HandleException(sender, eventArgs);
            MailboxTransportDeliveryService.diag.TraceDebug(0L, "Done processing unhandled exception. Return to CLR.");
        }
Beispiel #21
0
        private static void CrashOnCallTimeout(object state)
        {
            Thread    thread    = (Thread)state;
            Exception exception = new TimeoutException(string.Format("RpcServerWrapper.EnqueueRequest call timed out after {0} on thread {1}", RpcServerWrapper.enqueueRequestTimeout, (thread != null) ? thread.ManagedThreadId : -1));

            ExWatson.SendReportAndCrashOnAnotherThread(exception);
        }
        public override byte[] AcquireTenantLicenses(int version, byte[] inputParameterBytes)
        {
            XmlNode[] rac = null;
            XmlNode[] clc = null;
            AcquireTenantLicensesRpcParameters acquireTenantLicensesRpcParameters = null;

            byte[] result;
            try
            {
                acquireTenantLicensesRpcParameters = new AcquireTenantLicensesRpcParameters(inputParameterBytes);
                ServerManager.AcquireTenantLicenses(acquireTenantLicensesRpcParameters.ClientManagerContext, acquireTenantLicensesRpcParameters.MachineCertificateChain, acquireTenantLicensesRpcParameters.Identity, out rac, out clc);
                AcquireTenantLicensesRpcResults acquireTenantLicensesRpcResults = new AcquireTenantLicensesRpcResults(new OverallRpcResult(null), rac, clc);
                result = acquireTenantLicensesRpcResults.Serialize();
            }
            catch (Exception ex)
            {
                if (!(ex is RightsManagementServerException))
                {
                    ServerManagerLog.LogEvent(ServerManagerLog.Subcomponent.RpcServerWrapper, ServerManagerLog.EventType.Error, (acquireTenantLicensesRpcParameters != null) ? acquireTenantLicensesRpcParameters.ClientManagerContext : null, string.Format("ServerManager.AcquireTenantLicenses has thrown unhandled exception {0}", ServerManagerLog.GetExceptionLogString(ex, ServerManagerLog.ExceptionLogOption.IncludeStack | ServerManagerLog.ExceptionLogOption.IncludeInnerException)));
                    ExWatson.SendReportAndCrashOnAnotherThread(ex);
                }
                AcquireTenantLicensesRpcResults acquireTenantLicensesRpcResults2 = new AcquireTenantLicensesRpcResults(new OverallRpcResult(ex), Array <XmlNode> .Empty, Array <XmlNode> .Empty);
                result = acquireTenantLicensesRpcResults2.Serialize();
            }
            return(result);
        }
        private static void DoWithExtraWatsonData(Action action)
        {
            Command currentCommand = Command.CurrentCommand;
            string  text           = null;

            if (currentCommand != null && GlobalSettings.IncludeRequestInWatson)
            {
                text = "Request: \r\n" + currentCommand.Request.GetHeadersAsString();
                if (currentCommand.Request.XmlDocument != null && currentCommand.Request.XmlDocument.DocumentElement != null)
                {
                    text = text + "\r\n" + currentCommand.Request.XmlDocument.DocumentElement.OuterXml;
                }
                else
                {
                    text += "\r\n[No Body]";
                }
            }
            WatsonExtraDataReportAction watsonExtraDataReportAction = string.IsNullOrEmpty(text) ? null : new WatsonExtraDataReportAction(text);

            if (watsonExtraDataReportAction != null)
            {
                ExWatson.RegisterReportAction(watsonExtraDataReportAction, WatsonActionScope.Thread);
            }
            try
            {
                action();
            }
            finally
            {
                if (watsonExtraDataReportAction != null)
                {
                    ExWatson.UnregisterReportAction(watsonExtraDataReportAction, WatsonActionScope.Thread);
                }
            }
        }
        public override byte[] GetTenantActiveCryptoMode(int version, byte[] inputParameterBytes)
        {
            GetTenantActiveCryptoModeRpcParameters getTenantActiveCryptoModeRpcParameters = null;

            byte[] result;
            try
            {
                getTenantActiveCryptoModeRpcParameters = new GetTenantActiveCryptoModeRpcParameters(inputParameterBytes);
                int tenantActiveCryptoMode = ServerManager.GetTenantActiveCryptoMode(getTenantActiveCryptoModeRpcParameters.ClientManagerContext);
                ActiveCryptoModeResult[] originalResults = new ActiveCryptoModeResult[]
                {
                    new ActiveCryptoModeResult(tenantActiveCryptoMode, null)
                };
                GetTenantActiveCryptoModeRpcResults getTenantActiveCryptoModeRpcResults = new GetTenantActiveCryptoModeRpcResults(new OverallRpcResult(null), originalResults);
                result = getTenantActiveCryptoModeRpcResults.Serialize();
            }
            catch (Exception ex)
            {
                if (!(ex is RightsManagementServerException))
                {
                    ServerManagerLog.LogEvent(ServerManagerLog.Subcomponent.RpcServerWrapper, ServerManagerLog.EventType.Error, (getTenantActiveCryptoModeRpcParameters != null) ? getTenantActiveCryptoModeRpcParameters.ClientManagerContext : null, string.Format("ServerManager.GetTenantActiveCryptoMode has thrown unhandled exception {0}", ServerManagerLog.GetExceptionLogString(ex, ServerManagerLog.ExceptionLogOption.IncludeStack | ServerManagerLog.ExceptionLogOption.IncludeInnerException)));
                    ExWatson.SendReportAndCrashOnAnotherThread(ex);
                }
                GetTenantActiveCryptoModeRpcResults getTenantActiveCryptoModeRpcResults2 = new GetTenantActiveCryptoModeRpcResults(new OverallRpcResult(ex), Array <ActiveCryptoModeResult> .Empty);
                result = getTenantActiveCryptoModeRpcResults2.Serialize();
            }
            return(result);
        }
Beispiel #25
0
        // Token: 0x0600025A RID: 602 RVA: 0x0000FCC4 File Offset: 0x0000DEC4
        private void Application_Start(object sender, EventArgs e)
        {
            Globals.InitializeMultiPerfCounterInstance("AutoDisc");
            Microsoft.Exchange.Diagnostics.Components.Autodiscover.ExTraceGlobals.FrameworkTracer.TraceDebug <string>((long)this.GetHashCode(), "[Application_Start()] Privileges.RemoveAllExcept(,,\"{0}\");", "MSExchangeAutodiscoverAppPool");
            string[] privilegesToKeep = new string[]
            {
                "SeAuditPrivilege",
                "SeChangeNotifyPrivilege",
                "SeCreateGlobalPrivilege"
            };
            int num = Privileges.RemoveAllExcept(privilegesToKeep, "MSExchangeAutodiscoverAppPool");

            if (num != 0)
            {
                Microsoft.Exchange.Diagnostics.Components.Autodiscover.ExTraceGlobals.FrameworkTracer.TraceError <TimeSpan, int>((long)this.GetHashCode(), "[Application_Start()] 'Failed to remove privileges, exiting. Time=\"{0}\",win32Error=\"{1}\"'", ExDateTime.Now.TimeOfDay, num);
                Environment.Exit(num);
            }
            PerformanceCounters.Initialize();
            ExchangeDiagnosticsHelper.RegisterDiagnosticsComponents();
            Microsoft.Exchange.Diagnostics.Components.Autodiscover.ExTraceGlobals.FrameworkTracer.TraceDebug((long)this.GetHashCode(), "[Application_Start()] 'ApplicationStarted'");
            Common.EventLog.LogEvent(AutodiscoverEventLogConstants.Tuple_InfoWebApplicationStart, Common.PeriodicKey, new object[0]);
            string text = ExEnvironment.IsTest ? "E12" : "E12IIS";

            ExWatson.Register(text);
            Microsoft.Exchange.Diagnostics.Components.Autodiscover.ExTraceGlobals.FaultInjectionTracer.RegisterExceptionInjectionCallback(new ExceptionInjectionCallback(FaultInjection.Callback));
            Microsoft.Exchange.Diagnostics.Components.Autodiscover.ExTraceGlobals.FrameworkTracer.TraceDebug <string, string>((long)this.GetHashCode(), "[Application_Start()] ExWatson.Register(\"{0}\");AppName=\"{1}\";", text, ExWatson.AppName);
        }
Beispiel #26
0
 public static object GetSerializationData(PSObject psObject)
 {
     ExTraceGlobals.SerializationTracer.TraceFunction <PSObject>(0L, "SerializationTypeConvertor.GetSerializationData({0})", psObject);
     byte[] result = null;
     try
     {
         using (MemoryStream memoryStream = new MemoryStream())
         {
             BinaryFormatter binaryFormatter = ExchangeBinaryFormatterFactory.CreateBinaryFormatter(null);
             binaryFormatter.Serialize(memoryStream, psObject.BaseObject);
             result = memoryStream.ToArray();
         }
     }
     catch (Exception arg)
     {
         ExTraceGlobals.SerializationTracer.TraceDebug <Exception>(0L, "Serialization Failed. Error = {0}", arg);
         if (psObject != null && psObject.BaseObject != null)
         {
             ExWatson.AddExtraData("Object Type: " + psObject.BaseObject.GetType().ToString());
             ExWatson.AddExtraData("Object String: " + psObject.BaseObject.ToString());
             ExWatson.AddExtraData("Handler StackTrace: " + Environment.StackTrace);
         }
         throw;
     }
     return(result);
 }
 public void Init(HttpApplication application)
 {
     ExWatson.Register("E12");
     application.Error      += ErrorHandlingModule.Application_Error;
     application.EndRequest += ErrorHandlingModule.Application_EndRequest;
     application.PostAcquireRequestState += ErrorHandlingModule.Application_PostAcquireRequestState;
 }
        private void GetMailTipsWorker(object state)
        {
            MailTipsState mailTipsState = null;

            try
            {
                mailTipsState = (MailTipsState)state;
                ExTraceGlobals.CoreCallTracer.TraceDebug((long)this.GetHashCode(), "MailTipsNotificationHandler.GetMailTipsWorker");
                this.GetMailTipsInBatches(mailTipsState);
                this.mailTipsNotifier.AddToPayload(mailTipsState);
                this.mailTipsNotifier.PickupData();
            }
            catch (Exception ex)
            {
                ExTraceGlobals.CoreTracer.TraceError <Exception>((long)this.GetHashCode(), "Generic exception caught during GetMailTipsWorker call: {0}", ex);
                if (Globals.SendWatsonReports)
                {
                    ExTraceGlobals.CoreTracer.TraceError((long)this.GetHashCode(), "Sending watson report.");
                    ExWatson.AddExtraData(this.GetExtraWatsonData(mailTipsState));
                    ExWatson.SendReport(ex, ReportOptions.None, null);
                }
            }
            finally
            {
                Interlocked.Decrement(ref this.concurrentRequestCount);
                ExTraceGlobals.CoreCallTracer.TraceError <string, int>((long)this.GetHashCode(), "MailTipsNotificationHandler.GetMailTipsWorker, {0} concurrent requests count decremented to {1}", this.primarySmtpAddress, this.concurrentRequestCount);
            }
        }
Beispiel #29
0
 internal static void ExWatsonWrappedCall(ExWatson.MethodDelegate methodDelegate, ExWatson.MethodDelegate finallyDelegate)
 {
     ExWatson.SendReportOnUnhandledException(delegate()
     {
         try
         {
             GrayException.MapAndReportGrayExceptions(delegate()
             {
                 methodDelegate();
             });
         }
         catch (GrayException arg)
         {
             SearchUtils.Tracer.TraceError <GrayException>(0L, "GrayException {0} is thrown", arg);
         }
         finally
         {
             finallyDelegate();
         }
     }, delegate(object exception)
     {
         SearchUtils.Tracer.TraceError(0L, "ExWatsonWrappedCall: Unhandled exception {0}", new object[]
         {
             exception
         });
         return(!(exception is GrayException));
     });
 }
Beispiel #30
0
 private void ExecuteAsyncRequest(HttpWebRequest request)
 {
     try
     {
         ExTraceGlobals.CoreTracer.TraceDebug((long)this.GetHashCode(), "[PreloadSessionDataRequestCreator::ExecuteAsyncRequest]: Executing preload request");
         LiveIdAuthenticationCounters.TotalSessionDataPreloadRequestsSent.Increment();
         using (request.GetResponse())
         {
         }
     }
     catch (Exception ex)
     {
         if (!(ex is HttpException) && !(ex is WebException))
         {
             ExWatson.SendReport(ex, ReportOptions.DoNotFreezeThreads, null);
         }
         LiveIdAuthenticationCounters.TotalSessionDataPreloadRequestsFailed.Increment();
         ExTraceGlobals.CoreTracer.TraceError <Exception>(0L, "[PreloadSessionDataRequestCreator::ExecuteAsyncRequest]: General exception {0}.", ex);
     }
     finally
     {
         try
         {
             request.Abort();
         }
         catch
         {
         }
     }
 }