Exemplo n.º 1
0
        private static bool IsSendReportValid(Exception exception, ExWatson.IsExceptionInteresting isExceptionInteresting)
        {
            if (ExWatson.IsWatsonReportAlreadySent(exception))
            {
                return(false);
            }
            bool flag = isExceptionInteresting == null || isExceptionInteresting(exception);

            ExTraceGlobals.InstrumentationTracer.TraceDebug <bool>(0L, "IsSendReportValid isSendReportValid: {0}", flag);
            return(flag);
        }
Exemplo n.º 2
0
        // Token: 0x060012DD RID: 4829 RVA: 0x0003D4C8 File Offset: 0x0003B6C8
        internal static T ExecuteWSManPluginAPI <T>(string funcName, bool throwException, bool trackLatency, T defaultReturnValue, Func <T> func)
        {
            ExWatson.IsExceptionInteresting isExceptionInteresting = null;
            T result;

            try
            {
                AuthZLogger.SafeAppendColumn(RpsCommonMetadata.GenericLatency, funcName, DateTime.UtcNow.ToString());
                string                funcName2       = funcName;
                bool                  throwException2 = throwException;
                LatencyTracker        latencyTracker  = trackLatency ? AuthZLogHelper.latencyTracker : null;
                ExEventLog            rbacEventLogger = AuthZLogHelper.RbacEventLogger;
                ExEventLog.EventTuple tuple_RemotePSPublicAPIFailed = Microsoft.Exchange.Configuration.ObjectModel.EventLog.TaskEventLogConstants.Tuple_RemotePSPublicAPIFailed;
                Trace                 publicPluginAPITracer         = Microsoft.Exchange.Diagnostics.Components.Authorization.ExTraceGlobals.PublicPluginAPITracer;
                if (isExceptionInteresting == null)
                {
                    isExceptionInteresting = ((object ex) => AuthZPluginHelper.IsFatalException(ex as Exception));
                }
                result = Diagnostics.ExecuteAndLog <T>(funcName2, throwException2, latencyTracker, rbacEventLogger, tuple_RemotePSPublicAPIFailed, publicPluginAPITracer, isExceptionInteresting, delegate(Exception ex)
                {
                    AuthZLogHelper.LogException(ex, funcName, throwException);
                }, defaultReturnValue, () => AuthZLogHelper.HandleExceptionAndRetry <T>(funcName, func, throwException, defaultReturnValue));
            }
            catch (Exception ex)
            {
                string arg = (AuthZLogger.ActivityScope != null) ? AuthZLogger.ActivityScope.ActivityId.ToString() : null;
                AuthZLogHelper.EndLogging(true);
                Exception              ex3;
                string                 str     = string.Format("[FailureCategory={0}] ", FailureCategory.AuthZ + "-" + ex3.GetType().Name);
                string                 str2    = string.Format("[AuthZRequestId={0}]", arg);
                LocalizedString        message = new LocalizedString(str2 + str + ex3.Message);
                AuthorizationException ex2     = new AuthorizationException(message, ex3);
                throw ex2;
            }
            return(result);
        }
Exemplo n.º 3
0
        internal static T ExecuteAndLog <T>(string funcName, bool missionCritical, LatencyTracker latencyTracker, ExEventLog eventLog, ExEventLog.EventTuple eventTuple, Trace tracer, ExWatson.IsExceptionInteresting isExceptionInteresting, Action <Exception> onError, T defaultReturnValue, Func <T> func)
        {
            bool flag = false;
            T    result;

            try
            {
                tracer.TraceDebug <Func <T> >(0L, "[{0}] Enter.", func);
                if (latencyTracker != null)
                {
                    flag = latencyTracker.StartInternalTracking(funcName);
                }
                result = func();
            }
            catch (Exception ex)
            {
                if (onError != null)
                {
                    onError(ex);
                }
                Diagnostics.ReportException(ex, eventLog, eventTuple, isExceptionInteresting, null, tracer, string.Format("Func {0} throws Exception {{0}}.", funcName));
                if (missionCritical)
                {
                    throw;
                }
                result = defaultReturnValue;
            }
            finally
            {
                if (flag)
                {
                    latencyTracker.EndInternalTracking(funcName);
                }
                tracer.TraceDebug <Func <T> >(0L, "[{0}] Exit.", func);
            }
            return(result);
        }
Exemplo n.º 4
0
 internal static void ExecuteAndLog(string funcName, bool missionCritical, LatencyTracker latencyTracker, ExEventLog eventLog, ExEventLog.EventTuple eventTuple, Trace tracer, ExWatson.IsExceptionInteresting isExceptionInteresting, Action <Exception> onError, Action action)
 {
     Diagnostics.ExecuteAndLog <bool>(funcName, missionCritical, latencyTracker, eventLog, eventTuple, tracer, isExceptionInteresting, onError, true, delegate()
     {
         action();
         return(true);
     });
 }
Exemplo n.º 5
0
 internal static void ReportException(Exception exception, ExEventLog exEventLog, ExEventLog.EventTuple eventTuple, ExWatson.IsExceptionInteresting knownExceptions, object eventObject, Trace trace, string traceFormat)
 {
     Diagnostics.LogExceptionWithTrace(exEventLog, eventTuple, null, trace, eventObject, traceFormat, exception);
     if (Diagnostics.IsSendReportValid(exception, knownExceptions))
     {
         ExWatson.HandleException(new UnhandledExceptionEventArgs(exception, false), ReportOptions.None);
         ExWatson.SetWatsonReportAlreadySent(exception);
     }
 }