/// <summary> /// Gets trace definition like: IO Thread scheduler callback invoked. /// Event description ID=134, Level=verbose, Channel=Debug /// </summary> /// <param name="trace">The trace provider</param> /// <param name="eventTraceActivity">The event trace activity</param> internal static void ActionItemCallbackInvoked(EtwDiagnosticTrace trace, System.Runtime.Diagnostics.EventTraceActivity eventTraceActivity) { TracePayload payload = trace.GetSerializedPayload(null, null, null); if (TraceCore.IsEtwEventEnabled(trace, 14)) { TraceCore.WriteEtwEvent(trace, 14, eventTraceActivity, payload.AppDomainFriendlyName); } }
internal static void ActionItemScheduled(EtwDiagnosticTrace trace, EventTraceActivity eventTraceActivity) { TracePayload serializedPayload = trace.GetSerializedPayload(null, null, null); if (TraceCore.IsEtwEventEnabled(trace, 13)) { TraceCore.WriteEtwEvent(trace, 13, eventTraceActivity, serializedPayload.AppDomainFriendlyName); } }
internal static void EtwUnhandledException(EtwDiagnosticTrace trace, string param0, Exception exception) { TracePayload serializedPayload = trace.GetSerializedPayload(null, null, exception); if (TraceCore.IsEtwEventEnabled(trace, 17)) { TraceCore.WriteEtwEvent(trace, 17, null, param0, serializedPayload.SerializedException, serializedPayload.AppDomainFriendlyName); } }
/// <summary> /// Gets trace definition like: Throwing an exception. Source: {0}. Exception details: {1} /// Event description ID=57409, Level=verbose, Channel=Analytic /// </summary> /// <param name="trace">The trace provider</param> /// <param name="param0">Parameter 0 for event: Throwing an exception. Source: {0}. Exception details: {1}</param> /// <param name="param1">Parameter 1 for event: Throwing an exception. Source: {0}. Exception details: {1}</param> /// <param name="exception">Exception associated with the event</param> internal static void ThrowingEtwExceptionVerbose(EtwDiagnosticTrace trace, string param0, string param1, System.Exception exception) { TracePayload payload = trace.GetSerializedPayload(null, null, exception); if (TraceCore.IsEtwEventEnabled(trace, 19)) { TraceCore.WriteEtwEvent(trace, 19, null, param0, param1, payload.SerializedException, payload.AppDomainFriendlyName); } }
/// <summary> /// Gets trace definition like: BufferPool of size {0}, changing quota by {1}. /// Event description ID=132, Level=verbose, Channel=Debug /// </summary> /// <param name="trace">The trace provider</param> /// <param name="PoolSize">Parameter 0 for event: BufferPool of size {0}, changing quota by {1}.</param> /// <param name="Delta">Parameter 1 for event: BufferPool of size {0}, changing quota by {1}.</param> internal static void BufferPoolChangeQuota(EtwDiagnosticTrace trace, int PoolSize, int Delta) { TracePayload payload = trace.GetSerializedPayload(null, null, null); if (TraceCore.IsEtwEventEnabled(trace, 12)) { TraceCore.WriteEtwEvent(trace, 12, null, PoolSize, Delta, payload.AppDomainFriendlyName); } }
/// <summary> /// Gets trace definition like: Pool allocating {0} Bytes. /// Event description ID=131, Level=verbose, Channel=Debug /// </summary> /// <param name="trace">The trace provider</param> /// <param name="Size">Parameter 0 for event: Pool allocating {0} Bytes.</param> internal static void BufferPoolAllocation(EtwDiagnosticTrace trace, int Size) { TracePayload payload = trace.GetSerializedPayload(null, null, null); if (TraceCore.IsEtwEventEnabled(trace, 11)) { TraceCore.WriteEtwEvent(trace, 11, null, Size, payload.AppDomainFriendlyName); } }
/// <summary> /// Gets trace definition like: An unexpected failure occurred. Applications should not attempt to handle this error. For diagnostic purposes, this English message is associated with the failure: {0}. /// Event description ID=57395, Level=error, Channel=Analytic /// </summary> /// <param name="trace">The trace provider</param> /// <param name="param0">Parameter 0 for event: An unexpected failure occurred. Applications should not attempt to handle this error. For diagnostic purposes, this English message is associated with the failure: {0}.</param> internal static void ShipAssertExceptionMessage(EtwDiagnosticTrace trace, string param0) { TracePayload payload = trace.GetSerializedPayload(null, null, null); if (TraceCore.IsEtwEventEnabled(trace, 2)) { TraceCore.WriteEtwEvent(trace, 2, null, param0, payload.AppDomainFriendlyName); } if (trace.ShouldTraceToTraceSource(TraceEventLevel.Error)) { string description = string.Format(Culture, ResourceManager.GetString("ShipAssertExceptionMessage", Culture), param0); TraceCore.WriteTraceSource(trace, 2, description, payload); } }
/// <summary> /// Gets trace definition like: Unhandled exception. Exception details: {0} /// Event description ID=57397, Level=critical, Channel=Operational /// </summary> /// <param name="trace">The trace provider</param> /// <param name="param0">Parameter 0 for event: Unhandled exception. Exception details: {0}</param> /// <param name="exception">Exception associated with the event</param> internal static void UnhandledException(EtwDiagnosticTrace trace, string param0, System.Exception exception) { TracePayload payload = trace.GetSerializedPayload(null, null, exception); if (TraceCore.IsEtwEventEnabled(trace, 4)) { TraceCore.WriteEtwEvent(trace, 4, null, param0, payload.SerializedException, payload.AppDomainFriendlyName); } if (trace.ShouldTraceToTraceSource(TraceEventLevel.Critical)) { string description = string.Format(Culture, ResourceManager.GetString("UnhandledException", Culture), param0); TraceCore.WriteTraceSource(trace, 4, description, payload); } }
/// <summary> /// Gets trace definition like: Wrote to the EventLog. /// Event description ID=57403, Level=warning, Channel=Debug /// </summary> /// <param name="trace">The trace provider</param> /// <param name="traceRecord">Extended data (TraceRecord) for the event</param> internal static void TraceCodeEventLogWarning(EtwDiagnosticTrace trace, TraceRecord traceRecord) { TracePayload payload = trace.GetSerializedPayload(null, traceRecord, null); if (TraceCore.IsEtwEventEnabled(trace, 9)) { TraceCore.WriteEtwEvent(trace, 9, null, payload.ExtendedData, payload.AppDomainFriendlyName); } if (trace.ShouldTraceToTraceSource(TraceEventLevel.Warning)) { string description = string.Format(Culture, ResourceManager.GetString("TraceCodeEventLogWarning", Culture)); TraceCore.WriteTraceSource(trace, 9, description, payload); } }
/// <summary> /// Gets trace definition like: Throwing an exception. Source: {0}. Exception details: {1} /// Event description ID=57407, Level=verbose, Channel=Analytic /// </summary> /// <param name="trace">The trace provider</param> /// <param name="param0">Parameter 0 for event: Throwing an exception. Source: {0}. Exception details: {1}</param> /// <param name="param1">Parameter 1 for event: Throwing an exception. Source: {0}. Exception details: {1}</param> /// <param name="exception">Exception associated with the event</param> internal static void ThrowingExceptionVerbose(EtwDiagnosticTrace trace, string param0, string param1, System.Exception exception) { TracePayload payload = trace.GetSerializedPayload(null, null, exception); if (TraceCore.IsEtwEventEnabled(trace, 20)) { TraceCore.WriteEtwEvent(trace, 20, null, param0, param1, payload.SerializedException, payload.AppDomainFriendlyName); } if (trace.ShouldTraceToTraceSource(TraceEventLevel.Verbose)) { string description = string.Format(Culture, ResourceManager.GetString("ThrowingExceptionVerbose", Culture), param0, param1); TraceCore.WriteTraceSource(trace, 20, description, payload); } }
/// <summary> /// Gets trace definition like: AppDomain unloading. AppDomain.FriendlyName {0}, ProcessName {1}, ProcessId {2}. /// Event description ID=57393, Level=informational, Channel=Debug /// </summary> /// <param name="trace">The trace provider</param> /// <param name="appdomainName">Parameter 0 for event: AppDomain unloading. AppDomain.FriendlyName {0}, ProcessName {1}, ProcessId {2}.</param> /// <param name="processName">Parameter 1 for event: AppDomain unloading. AppDomain.FriendlyName {0}, ProcessName {1}, ProcessId {2}.</param> /// <param name="processId">Parameter 2 for event: AppDomain unloading. AppDomain.FriendlyName {0}, ProcessName {1}, ProcessId {2}.</param> internal static void AppDomainUnload(EtwDiagnosticTrace trace, string appdomainName, string processName, string processId) { TracePayload payload = trace.GetSerializedPayload(null, null, null); if (TraceCore.IsEtwEventEnabled(trace, 0)) { TraceCore.WriteEtwEvent(trace, 0, null, appdomainName, processName, processId, payload.AppDomainFriendlyName); } if (trace.ShouldTraceToTraceSource(TraceEventLevel.Informational)) { string description = string.Format(Culture, ResourceManager.GetString("AppDomainUnload", Culture), appdomainName, processName, processId); TraceCore.WriteTraceSource(trace, 0, description, payload); } }
internal static void TraceCodeEventLogInfo(DiagnosticTrace trace, TraceRecord traceRecord) { TracePayload payload = trace.GetSerializedPayload(null, traceRecord, null); if (IsEtwEventEnabled(trace, 8)) { WriteEtwEvent(trace, 8, payload.ExtendedData, payload.AppDomainFriendlyName); } if (trace.ShouldTraceToTraceSource(TraceEventLevel.Informational)) { string description = string.Format(Culture, ResourceManager.GetString("TraceCodeEventLogInfo", Culture), new object[0]); WriteTraceSource(trace, 8, description, payload); } }
internal static void TraceCodeEventLogVerbose(EtwDiagnosticTrace trace, TraceRecord traceRecord) { TracePayload serializedPayload = trace.GetSerializedPayload(null, traceRecord, null); if (TraceCore.IsEtwEventEnabled(trace, 8)) { TraceCore.WriteEtwEvent(trace, 8, null, serializedPayload.ExtendedData, serializedPayload.AppDomainFriendlyName); } if (trace.ShouldTraceToTraceSource(TraceEventLevel.Verbose)) { string str = string.Format(TraceCore.Culture, TraceCore.ResourceManager.GetString("TraceCodeEventLogVerbose", TraceCore.Culture), new object[0]); TraceCore.WriteTraceSource(trace, 8, str, serializedPayload); } }
internal static void HandledExceptionWarning(DiagnosticTrace trace, Exception exception) { TracePayload payload = trace.GetSerializedPayload(null, null, exception); if (IsEtwEventEnabled(trace, 11)) { WriteEtwEvent(trace, 11, payload.SerializedException, payload.AppDomainFriendlyName); } if (trace.ShouldTraceToTraceSource(TraceEventLevel.Warning)) { string description = string.Format(Culture, ResourceManager.GetString("HandledExceptionWarning", Culture), new object[0]); WriteTraceSource(trace, 11, description, payload); } }
internal static void AppDomainUnload(DiagnosticTrace trace, string param0, string param1, string param2) { TracePayload payload = trace.GetSerializedPayload(null, null, null); if (IsEtwEventEnabled(trace, 0)) { WriteEtwEvent(trace, 0, param0, param1, param2, payload.AppDomainFriendlyName); } if (trace.ShouldTraceToTraceSource(TraceEventLevel.Informational)) { string description = string.Format(Culture, ResourceManager.GetString("AppDomainUnload", Culture), new object[] { param0, param1, param2 }); WriteTraceSource(trace, 0, description, payload); } }
internal static void ThrowingException(DiagnosticTrace trace, string param0, Exception exception) { TracePayload payload = trace.GetSerializedPayload(null, null, exception); if (IsEtwEventEnabled(trace, 3)) { WriteEtwEvent(trace, 3, param0, payload.SerializedException, payload.AppDomainFriendlyName); } if (trace.ShouldTraceToTraceSource(TraceEventLevel.Error)) { string description = string.Format(Culture, ResourceManager.GetString("ThrowingException", Culture), new object[] { param0 }); WriteTraceSource(trace, 3, description, payload); } }
internal static void MaxInstancesExceeded(DiagnosticTrace trace, int limit) { TracePayload payload = trace.GetSerializedPayload(null, null, null); if (IsEtwEventEnabled(trace, 5)) { WriteEtwEvent(trace, 5, limit, payload.AppDomainFriendlyName); } if (trace.ShouldTraceToTraceSource(TraceEventLevel.Warning)) { string description = string.Format(Culture, ResourceManager.GetString("MaxInstancesExceeded", Culture), new object[] { limit }); WriteTraceSource(trace, 5, description, payload); } }
internal static void ShipAssertExceptionMessage(EtwDiagnosticTrace trace, string param0) { TracePayload serializedPayload = trace.GetSerializedPayload(null, null, null); if (TraceCore.IsEtwEventEnabled(trace, 2)) { TraceCore.WriteEtwEvent(trace, 2, null, param0, serializedPayload.AppDomainFriendlyName); } if (trace.ShouldTraceToTraceSource(TraceEventLevel.Error)) { object[] objArray = new object[1]; objArray[0] = param0; string str = string.Format(TraceCore.Culture, TraceCore.ResourceManager.GetString("ShipAssertExceptionMessage", TraceCore.Culture), objArray); TraceCore.WriteTraceSource(trace, 2, str, serializedPayload); } }
internal static void UnhandledException(EtwDiagnosticTrace trace, string param0, Exception exception) { TracePayload serializedPayload = trace.GetSerializedPayload(null, null, exception); if (TraceCore.IsEtwEventEnabled(trace, 4)) { TraceCore.WriteEtwEvent(trace, 4, null, param0, serializedPayload.SerializedException, serializedPayload.AppDomainFriendlyName); } if (trace.ShouldTraceToTraceSource(TraceEventLevel.Critical)) { object[] objArray = new object[1]; objArray[0] = param0; string str = string.Format(TraceCore.Culture, TraceCore.ResourceManager.GetString("UnhandledException", TraceCore.Culture), objArray); TraceCore.WriteTraceSource(trace, 4, str, serializedPayload); } }
internal static void ThrowingExceptionVerbose(EtwDiagnosticTrace trace, string param0, string param1, Exception exception) { TracePayload serializedPayload = trace.GetSerializedPayload(null, null, exception); if (TraceCore.IsEtwEventEnabled(trace, 20)) { TraceCore.WriteEtwEvent(trace, 20, null, param0, param1, serializedPayload.SerializedException, serializedPayload.AppDomainFriendlyName); } if (trace.ShouldTraceToTraceSource(TraceEventLevel.Verbose)) { object[] objArray = new object[2]; objArray[0] = param0; objArray[1] = param1; string str = string.Format(TraceCore.Culture, TraceCore.ResourceManager.GetString("ThrowingExceptionVerbose", TraceCore.Culture), objArray); TraceCore.WriteTraceSource(trace, 20, str, serializedPayload); } }
internal static void AppDomainUnload(EtwDiagnosticTrace trace, string appdomainName, string processName, string processId) { TracePayload serializedPayload = trace.GetSerializedPayload(null, null, null); if (TraceCore.IsEtwEventEnabled(trace, 0)) { TraceCore.WriteEtwEvent(trace, 0, null, appdomainName, processName, processId, serializedPayload.AppDomainFriendlyName); } if (trace.ShouldTraceToTraceSource(TraceEventLevel.Informational)) { object[] objArray = new object[3]; objArray[0] = appdomainName; objArray[1] = processName; objArray[2] = processId; string str = string.Format(TraceCore.Culture, TraceCore.ResourceManager.GetString("AppDomainUnload", TraceCore.Culture), objArray); TraceCore.WriteTraceSource(trace, 0, str, serializedPayload); } }
static void WriteTraceSource(EtwDiagnosticTrace trace, int eventIndex, string description, TracePayload payload) { EnsureEventDescriptors(); trace.WriteTraceSource(ref eventDescriptors[eventIndex], description, payload); }
static void WriteTraceSource(EtwDiagnosticTrace trace, int eventIndex, string description, TracePayload payload) { }
private static string BuildTrace(ref EventDescriptor eventDescriptor, string description, TracePayload payload, string msdnTraceCode) { string str; StringBuilder stringBuilder = EtwDiagnosticTrace.StringBuilderPool.Take(); try { using (StringWriter stringWriter = new StringWriter(stringBuilder, CultureInfo.CurrentCulture)) { using (XmlTextWriter xmlTextWriter = new XmlTextWriter(stringWriter)) { xmlTextWriter.WriteStartElement("TraceRecord"); xmlTextWriter.WriteAttributeString("xmlns", "http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord"); xmlTextWriter.WriteAttributeString("Severity", TraceLevelHelper.LookupSeverity((TraceEventLevel)eventDescriptor.Level, (TraceEventOpcode)eventDescriptor.Opcode)); xmlTextWriter.WriteAttributeString("Channel", EtwDiagnosticTrace.LookupChannel((TraceChannel)eventDescriptor.Channel)); xmlTextWriter.WriteElementString("TraceIdentifier", msdnTraceCode); xmlTextWriter.WriteElementString("Description", description); xmlTextWriter.WriteElementString("AppDomain", payload.AppDomainFriendlyName); if (!string.IsNullOrEmpty(payload.EventSource)) { xmlTextWriter.WriteElementString("Source", payload.EventSource); } if (!string.IsNullOrEmpty(payload.ExtendedData)) { xmlTextWriter.WriteRaw(payload.ExtendedData); } if (!string.IsNullOrEmpty(payload.SerializedException)) { xmlTextWriter.WriteRaw(payload.SerializedException); } xmlTextWriter.WriteEndElement(); xmlTextWriter.Flush(); stringWriter.Flush(); str = stringBuilder.ToString(); } } } finally { EtwDiagnosticTrace.StringBuilderPool.Return(stringBuilder); } return str; }
public void WriteTraceSource(ref EventDescriptor eventDescriptor, string description, TracePayload payload) { string str = null; int num = 0; string empty; if (base.TracingEnabled) { XPathNavigator xPathNavigator = null; try { EtwDiagnosticTrace.GenerateLegacyTraceCode(ref eventDescriptor, out str, out num); string str1 = EtwDiagnosticTrace.BuildTrace(ref eventDescriptor, description, payload, str); XmlDocument xmlDocument = new XmlDocument(); xmlDocument.LoadXml(str1); xPathNavigator = xmlDocument.CreateNavigator(); base.TraceSource.TraceData(TraceLevelHelper.GetTraceEventType(eventDescriptor.Level, eventDescriptor.Opcode), num, xPathNavigator); if (base.CalledShutdown) { base.TraceSource.Flush(); } } catch (Exception exception1) { Exception exception = exception1; if (!Fx.IsFatal(exception)) { EtwDiagnosticTrace etwDiagnosticTrace = this; if (xPathNavigator == null) { empty = string.Empty; } else { empty = xPathNavigator.ToString(); } etwDiagnosticTrace.LogTraceFailure(empty, exception); } else { throw; } } } }
static void WriteTraceSource(EtwDiagnosticTrace trace, int eventIndex, string description, TracePayload payload) { }
private static void WriteTraceSource(DiagnosticTrace trace, int eventIndex, string description, TracePayload payload) { EnsureEventDescriptors(); trace.WriteTraceSource(ref eventDescriptors[eventIndex], description, payload); }
public void WriteTraceSource(ref System.Diagnostics.Eventing.EventDescriptor eventDescriptor, string description, TracePayload payload) { if (this.TracingEnabled) { XPathNavigator data = null; try { string xml = BuildTrace(ref eventDescriptor, description, payload); XmlDocument document = new XmlDocument(); document.LoadXml(xml); data = document.CreateNavigator(); this.TraceSource.TraceData(TraceLevelHelper.GetTraceEventType(eventDescriptor.Level, eventDescriptor.Opcode), eventDescriptor.EventId, data); if (this.calledShutdown) { this.TraceSource.Flush(); } } catch (Exception exception) { if (Fx.IsFatal(exception)) { throw; } this.LogTraceFailure((data == null) ? string.Empty : data.ToString(), exception); } } }
private static void WriteTraceSource(int eventIndex, string description, TracePayload payload) { EnsureEventDescriptors(); FxTrace.Trace.WriteTraceSource(ref eventDescriptors[eventIndex], description, payload); }
private static string BuildTrace(ref System.Diagnostics.Eventing.EventDescriptor eventDescriptor, string description, TracePayload payload) { StringBuilder sb = new StringBuilder(); XmlTextWriter writer = new XmlTextWriter(new StringWriter(sb, CultureInfo.CurrentCulture)); writer.WriteStartElement("TraceRecord"); writer.WriteAttributeString("xmlns", "http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord"); writer.WriteAttributeString("Severity", TraceLevelHelper.LookupSeverity((TraceEventLevel) eventDescriptor.Level, (TraceEventOpcode) eventDescriptor.Opcode)); writer.WriteAttributeString("Channel", LookupChannel((TraceChannel) eventDescriptor.Channel)); writer.WriteElementString("TraceIdentifier", GenerateTraceCode(ref eventDescriptor)); writer.WriteElementString("Description", description); writer.WriteElementString("AppDomain", payload.AppDomainFriendlyName); if (!string.IsNullOrEmpty(payload.EventSource)) { writer.WriteElementString("Source", payload.EventSource); } if (!string.IsNullOrEmpty(payload.ExtendedData)) { writer.WriteRaw(payload.ExtendedData); } if (!string.IsNullOrEmpty(payload.SerializedException)) { writer.WriteRaw(payload.SerializedException); } writer.WriteEndElement(); return sb.ToString(); }