public DefaultActionItem(Action <object> callback, object state, bool isLowPriority) { Fx.Assert(callback != null, "Shouldn't instantiate an object to wrap a null callback"); base.LowPriority = isLowPriority; _callback = callback; _state = state; if (WaitCallbackActionItem.ShouldUseActivity) { _flowLegacyActivityId = true; _activityId = EtwDiagnosticTrace.ActivityId; } if (Fx.Trace.IsEnd2EndActivityTracingEnabled) { _eventTraceActivity = EventTraceActivity.GetFromThreadOrCreate(); if (TraceCore.ActionItemScheduledIsEnabled(Fx.Trace)) { TraceCore.ActionItemScheduled(Fx.Trace, _eventTraceActivity); } } }
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); }
public void TraceHandledException(Exception exception, TraceEventType traceEventType) { switch (traceEventType) { case TraceEventType.Error: if (!TraceCore.HandledExceptionErrorIsEnabled(_diagnosticTrace)) { break; } TraceCore.HandledExceptionError(_diagnosticTrace, exception != null ? exception.ToString() : string.Empty, exception); break; case TraceEventType.Warning: if (!TraceCore.HandledExceptionWarningIsEnabled(_diagnosticTrace)) { break; } TraceCore.HandledExceptionWarning(_diagnosticTrace, exception != null ? exception.ToString() : string.Empty, exception); break; case TraceEventType.Verbose: if (!TraceCore.HandledExceptionVerboseIsEnabled(_diagnosticTrace)) { break; } TraceCore.HandledExceptionVerbose(_diagnosticTrace, exception != null ? exception.ToString() : string.Empty, exception); break; default: if (!TraceCore.HandledExceptionIsEnabled(_diagnosticTrace)) { break; } TraceCore.HandledException(_diagnosticTrace, exception != null ? exception.ToString() : string.Empty, exception); break; } }
private static void EnsureEventDescriptors() { if (TraceCore.eventDescriptorsCreated == null) { Monitor.Enter(TraceCore.syncLock); try { if (TraceCore.eventDescriptorsCreated == null) { TraceCore.CreateEventDescriptors(); TraceCore.eventDescriptorsCreated = true; } } finally { Monitor.Exit(TraceCore.syncLock); } return; } else { return; } }
private void ChangeQuota(ref InternalBufferManager.PooledBufferManager.BufferPool bufferPool, int delta) { if (TraceCore.BufferPoolChangeQuotaIsEnabled(Fx.Trace)) { TraceCore.BufferPoolChangeQuota(Fx.Trace, bufferPool.BufferSize, delta); } InternalBufferManager.PooledBufferManager.BufferPool bufferPool1 = bufferPool; int limit = bufferPool1.Limit + delta; InternalBufferManager.PooledBufferManager.BufferPool bufferPool2 = InternalBufferManager.PooledBufferManager.BufferPool.CreatePool(bufferPool1.BufferSize, limit); for (int i = 0; i < limit; i++) { byte[] numArray = bufferPool1.Take(); if (numArray == null) { break; } bufferPool2.Return(numArray); bufferPool2.IncrementCount(); } InternalBufferManager.PooledBufferManager bufferSize = this; bufferSize.remainingMemory = bufferSize.remainingMemory - (long)(bufferPool1.BufferSize * delta); bufferPool = bufferPool2; }
private void ChangeQuota(ref BufferPool bufferPool, int delta) { if (TraceCore.BufferPoolChangeQuotaIsEnabled(Fx.Trace)) { TraceCore.BufferPoolChangeQuota(Fx.Trace, bufferPool.BufferSize, delta); } BufferPool oldBufferPool = bufferPool; int newLimit = oldBufferPool.Limit + delta; BufferPool newBufferPool = BufferPool.CreatePool(oldBufferPool.BufferSize, newLimit); for (int i = 0; i < newLimit; i++) { byte[] buffer = oldBufferPool.Take(); if (buffer == null) { break; } newBufferPool.Return(buffer); newBufferPool.IncrementCount(); } _remainingMemory -= oldBufferPool.BufferSize * delta; bufferPool = newBufferPool; }
public void AsWarning(Exception exception) { TraceCore.HandledExceptionWarning(Fx.Trace, exception); }
public void AsInformation(Exception exception) { TraceCore.HandledException(Fx.Trace, exception); }
public void TraceUnhandledException(Exception exception) { TraceCore.UnhandledException(Fx.Trace, exception); }
public void AsWarning(Exception exception) { //Traces a warning trace message TraceCore.HandledExceptionWarning(this.diagnosticTrace, exception != null ? exception.ToString() : string.Empty, exception); }
/// <summary> /// Check if trace definition is enabled /// Event description ID=57403, Level=warning, Channel=Debug /// </summary> /// <param name="trace">The trace provider</param> internal static bool TraceCodeEventLogWarningIsEnabled(EtwDiagnosticTrace trace) { return(trace.ShouldTrace(TraceEventLevel.Warning) || TraceCore.IsEtwEventEnabled(trace, 9)); }
/// <summary> /// Check if trace definition is enabled /// Event description ID=133, Level=verbose, Channel=Debug /// </summary> /// <param name="trace">The trace provider</param> internal static bool ActionItemScheduledIsEnabled(EtwDiagnosticTrace trace) { return(TraceCore.IsEtwEventEnabled(trace, 13)); }
/// <summary> /// Check if trace definition is enabled /// Event description ID=131, Level=verbose, Channel=Debug /// </summary> /// <param name="trace">The trace provider</param> internal static bool BufferPoolAllocationIsEnabled(EtwDiagnosticTrace trace) { return(TraceCore.IsEtwEventEnabled(trace, 11)); }
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; } } }
/// <summary> /// Check if trace definition is enabled /// Event description ID=57394, Level=informational, Channel=Analytic /// </summary> /// <param name="trace">The trace provider</param> internal static bool HandledExceptionIsEnabled(EtwDiagnosticTrace trace) { return(trace.ShouldTrace(TraceEventLevel.Informational) || TraceCore.IsEtwEventEnabled(trace, 1)); }
/// <summary> /// Check if trace definition is enabled /// Event description ID=57407, Level=verbose, Channel=Analytic /// </summary> /// <param name="trace">The trace provider</param> internal static bool ThrowingExceptionVerboseIsEnabled(EtwDiagnosticTrace trace) { return(trace.ShouldTrace(TraceEventLevel.Verbose) || TraceCore.IsEtwEventEnabled(trace, 20)); }
/// <summary> /// Check if trace definition is enabled /// Event description ID=57393, Level=informational, Channel=Debug /// </summary> /// <param name="trace">The trace provider</param> internal static bool AppDomainUnloadIsEnabled(EtwDiagnosticTrace trace) { return(trace.ShouldTrace(TraceEventLevel.Informational) || TraceCore.IsEtwEventEnabled(trace, 0)); }
/// <summary> /// Check if trace definition is enabled /// Event description ID=57405, Level=error, Channel=Operational /// </summary> /// <param name="trace">The trace provider</param> internal static bool HandledExceptionErrorIsEnabled(EtwDiagnosticTrace trace) { return(trace.ShouldTrace(TraceEventLevel.Error) || TraceCore.IsEtwEventEnabled(trace, 15)); }
/// <summary> /// Check if trace definition is enabled /// Event description ID=57404, Level=warning, Channel=Analytic /// </summary> /// <param name="trace">The trace provider</param> internal static bool HandledExceptionWarningIsEnabled(EtwDiagnosticTrace trace) { return(trace.ShouldTrace(TraceEventLevel.Warning) || TraceCore.IsEtwEventEnabled(trace, 10)); }
private TException TraceException <TException>(TException exception, string eventSource) where TException : Exception { TraceCore.ThrowingException(Fx.Trace, eventSource, exception); this.BreakOnException(exception); return(exception); }
/// <summary> /// Check if trace definition is enabled /// Event description ID=57408, Level=critical, Channel=Operational /// </summary> /// <param name="trace">The trace provider</param> internal static bool EtwUnhandledExceptionIsEnabled(EtwDiagnosticTrace trace) { return(TraceCore.IsEtwEventEnabled(trace, 17)); }
public void TraceUnhandledException(Exception exception) { TraceCore.UnhandledException(_diagnosticTrace, exception != null ? exception.ToString() : string.Empty, exception); }
/// <summary> /// Check if trace definition is enabled /// Event description ID=132, Level=verbose, Channel=Debug /// </summary> /// <param name="trace">The trace provider</param> internal static bool BufferPoolChangeQuotaIsEnabled(EtwDiagnosticTrace trace) { return(TraceCore.IsEtwEventEnabled(trace, 12)); }
/// <summary> /// Check if trace definition is enabled /// Event description ID=57401, Level=informational, Channel=Debug /// </summary> /// <param name="trace">The trace provider</param> internal static bool TraceCodeEventLogInfoIsEnabled(EtwDiagnosticTrace trace) { return(trace.ShouldTrace(TraceEventLevel.Informational) || TraceCore.IsEtwEventEnabled(trace, 7)); }
/// <summary> /// Check if trace definition is enabled /// Event description ID=134, Level=verbose, Channel=Debug /// </summary> /// <param name="trace">The trace provider</param> internal static bool ActionItemCallbackInvokedIsEnabled(EtwDiagnosticTrace trace) { return(TraceCore.IsEtwEventEnabled(trace, 14)); }
/// <summary> /// Check if trace definition is enabled /// Event description ID=57402, Level=verbose, Channel=Debug /// </summary> /// <param name="trace">The trace provider</param> internal static bool TraceCodeEventLogVerboseIsEnabled(EtwDiagnosticTrace trace) { return(trace.ShouldTrace(TraceEventLevel.Verbose) || TraceCore.IsEtwEventEnabled(trace, 8)); }
/// <summary> /// Check if trace definition is enabled /// Event description ID=57409, Level=verbose, Channel=Analytic /// </summary> /// <param name="trace">The trace provider</param> internal static bool ThrowingEtwExceptionVerboseIsEnabled(EtwDiagnosticTrace trace) { return(TraceCore.IsEtwEventEnabled(trace, 19)); }
public void TraceHandledException(Exception exception, TraceEventType traceEventType) { string str; string empty; string str1; string empty1; TraceEventType traceEventType1 = traceEventType; switch (traceEventType1) { case TraceEventType.Error: { if (!TraceCore.HandledExceptionErrorIsEnabled(this.diagnosticTrace)) { break; } EtwDiagnosticTrace etwDiagnosticTrace = this.diagnosticTrace; if (exception != null) { str = exception.ToString(); } else { str = string.Empty; } TraceCore.HandledExceptionError(etwDiagnosticTrace, str, exception); return; } case TraceEventType.Critical | TraceEventType.Error: { if (!TraceCore.HandledExceptionIsEnabled(this.diagnosticTrace)) { break; } EtwDiagnosticTrace etwDiagnosticTrace1 = this.diagnosticTrace; if (exception != null) { empty = exception.ToString(); } else { empty = string.Empty; } TraceCore.HandledException(etwDiagnosticTrace1, empty, exception); break; } case TraceEventType.Warning: { if (!TraceCore.HandledExceptionWarningIsEnabled(this.diagnosticTrace)) { break; } EtwDiagnosticTrace etwDiagnosticTrace2 = this.diagnosticTrace; if (exception != null) { str1 = exception.ToString(); } else { str1 = string.Empty; } TraceCore.HandledExceptionWarning(etwDiagnosticTrace2, str1, exception); return; } default: { if (traceEventType1 == TraceEventType.Verbose) { if (!TraceCore.HandledExceptionVerboseIsEnabled(this.diagnosticTrace)) { break; } EtwDiagnosticTrace etwDiagnosticTrace3 = this.diagnosticTrace; if (exception != null) { empty1 = exception.ToString(); } else { empty1 = string.Empty; } TraceCore.HandledExceptionVerbose(etwDiagnosticTrace3, empty1, exception); return; } else { if (!TraceCore.HandledExceptionIsEnabled(this.diagnosticTrace)) { break; } EtwDiagnosticTrace etwDiagnosticTrace1 = this.diagnosticTrace; if (exception != null) { empty = exception.ToString(); } else { empty = string.Empty; } TraceCore.HandledException(etwDiagnosticTrace1, empty, exception); break; } } } }
public static Exception AssertAndThrowFatal(string description) { Fx.Assert(description); TraceCore.ShipAssertExceptionMessage(Trace, description); throw new FatalInternalException(description); }
public void AsInformation(Exception exception) { //Traces an informational trace message TraceCore.HandledException(this.diagnosticTrace, exception != null ? exception.ToString() : string.Empty, exception); }