示例#1
0
        public void TraceEtwException(Exception exception, TraceEventType eventType)
        {
            switch (eventType)
            {
            case TraceEventType.Error:
            case TraceEventType.Warning:
                if (TraceCore.ThrowingExceptionIsEnabled(this.diagnosticTrace))
                {
                    TraceCore.ThrowingEtwException(this.diagnosticTrace, this.eventSourceName, exception != null ? exception.ToString() : string.Empty, exception);
                }
                break;

            case TraceEventType.Critical:
                if (TraceCore.UnhandledExceptionIsEnabled(this.diagnosticTrace))
                {
                    TraceCore.EtwUnhandledException(this.diagnosticTrace, exception != null ? exception.ToString() : string.Empty, exception);
                }
                break;

            default:
                if (TraceCore.ThrowingExceptionVerboseIsEnabled(this.diagnosticTrace))
                {
                    TraceCore.ThrowingEtwExceptionVerbose(this.diagnosticTrace, this.eventSourceName, exception != null ? exception.ToString() : string.Empty, exception);
                }
                break;
            }
        }
示例#2
0
        private TException TraceException <TException>(TException exception, string eventSource)
            where TException : Exception
        {
            if (TraceCore.ThrowingExceptionIsEnabled(_diagnosticTrace))
            {
                TraceCore.ThrowingException(_diagnosticTrace, eventSource, exception != null ? exception.ToString() : string.Empty, exception);
            }

            BreakOnException(exception);

            return(exception);
        }
示例#3
0
        private TException TraceException <TException>(TException exception, string eventSource)
            where TException : Exception
        {
            string str;

            if (TraceCore.ThrowingExceptionIsEnabled(this.diagnosticTrace))
            {
                EtwDiagnosticTrace etwDiagnosticTrace = this.diagnosticTrace;
                string             str1 = eventSource;
                if (exception != null)
                {
                    str = exception.ToString();
                }
                else
                {
                    str = string.Empty;
                }
                TraceCore.ThrowingException(etwDiagnosticTrace, str1, str, exception);
            }
            this.BreakOnException(exception);
            return(exception);
        }
示例#4
0
        public void TraceEtwException(Exception exception, TraceEventType eventType)
        {
            string         str;
            string         empty;
            string         str1;
            TraceEventType traceEventType = eventType;

            switch (traceEventType)
            {
            case TraceEventType.Critical:
            {
                if (!TraceCore.UnhandledExceptionIsEnabled(this.diagnosticTrace))
                {
                    break;
                }
                EtwDiagnosticTrace etwDiagnosticTrace = this.diagnosticTrace;
                if (exception != null)
                {
                    str = exception.ToString();
                }
                else
                {
                    str = string.Empty;
                }
                TraceCore.EtwUnhandledException(etwDiagnosticTrace, str, exception);
                return;
            }

            case TraceEventType.Error:
            case TraceEventType.Warning:
            {
                if (!TraceCore.ThrowingExceptionIsEnabled(this.diagnosticTrace))
                {
                    break;
                }
                EtwDiagnosticTrace etwDiagnosticTrace1 = this.diagnosticTrace;
                string             str2 = this.eventSourceName;
                if (exception != null)
                {
                    empty = exception.ToString();
                }
                else
                {
                    empty = string.Empty;
                }
                TraceCore.ThrowingEtwException(etwDiagnosticTrace1, str2, empty, exception);
                return;
            }

            case TraceEventType.Critical | TraceEventType.Error:
            {
                if (!TraceCore.ThrowingExceptionVerboseIsEnabled(this.diagnosticTrace))
                {
                    break;
                }
                EtwDiagnosticTrace etwDiagnosticTrace2 = this.diagnosticTrace;
                string             str3 = this.eventSourceName;
                if (exception != null)
                {
                    str1 = exception.ToString();
                }
                else
                {
                    str1 = string.Empty;
                }
                TraceCore.ThrowingEtwExceptionVerbose(etwDiagnosticTrace2, str3, str1, exception);
                break;
            }

            default:
            {
                if (!TraceCore.ThrowingExceptionVerboseIsEnabled(this.diagnosticTrace))
                {
                    break;
                }
                EtwDiagnosticTrace etwDiagnosticTrace2 = this.diagnosticTrace;
                string             str3 = this.eventSourceName;
                if (exception != null)
                {
                    str1 = exception.ToString();
                }
                else
                {
                    str1 = string.Empty;
                }
                TraceCore.ThrowingEtwExceptionVerbose(etwDiagnosticTrace2, str3, str1, exception);
                break;
            }
            }
        }