//------------------------------------------------------------------------------ // // This code was generated by a tool. // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // //------------------------------------------------------------------------------ namespace System.Xaml.Hosting { using System.Runtime; using System.Runtime.Diagnostics; using System.Security; internal partial class TD { static System.Resources.ResourceManager resourceManager; static System.Globalization.CultureInfo resourceCulture; [System.Security.SecurityCriticalAttribute()] static System.Runtime.Diagnostics.EventDescriptor[] eventDescriptors; static object syncLock = new object(); // Double-checked locking pattern requires volatile for read/write synchronization static volatile bool eventDescriptorsCreated; private TD() { } [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification="This is an auto-generated code, some ETW/TraceSource mixed code would use it.")] static System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceManager, null)) { resourceManager = new System.Resources.ResourceManager("System.Xaml.Hosting.TD", typeof(TD).Assembly); } return resourceManager; } } [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification="This template is shared across all assemblies, some of which use this accessor.")] internal static System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } /// /// Check if trace definition is enabled /// Event description ID=62326, Level=Informational, Channel=debug /// internal static bool HttpHandlerPickedForUrlIsEnabled() { return (FxTrace.ShouldTraceInformation && (FxTrace.ShouldTraceInformationToTraceSource || TD.IsEtwEventEnabled(0))); } /// /// Gets trace definition like: The url '{0}' hosts XAML document with root element type '{1}'. The HTTP handler type '{2}' is picked to serve all the requests made to this url. /// Event description ID=62326, Level=Informational, Channel=debug /// /// Parameter 0 for event: The url '{0}' hosts XAML document with root element type '{1}'. The HTTP handler type '{2}' is picked to serve all the requests made to this url. /// Parameter 1 for event: The url '{0}' hosts XAML document with root element type '{1}'. The HTTP handler type '{2}' is picked to serve all the requests made to this url. /// Parameter 2 for event: The url '{0}' hosts XAML document with root element type '{1}'. The HTTP handler type '{2}' is picked to serve all the requests made to this url. internal static void HttpHandlerPickedForUrl(string param0, string param1, string param2) { TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null); if (TD.IsEtwEventEnabled(0)) { TD.WriteEtwEvent(0, null, param0, param1, param2, payload.AppDomainFriendlyName); } if (FxTrace.ShouldTraceInformationToTraceSource) { string description = string.Format(Culture, ResourceManager.GetString("HttpHandlerPickedForUrl", Culture), param0, param1, param2); TD.WriteTraceSource(0, description, payload); } } /// /// Creates the event descriptors array /// static void CreateEventDescriptors() { System.Runtime.Diagnostics.EventDescriptor[] descriptors = new System.Runtime.Diagnostics.EventDescriptor[] { new System.Runtime.Diagnostics.EventDescriptor(62326, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Informational, (byte)TraceEventOpcode.Info, 0x9de, 0x1000000000000080)}; ushort[] e2eEvents = new ushort[0]; FxTrace.UpdateEventDefinitions(descriptors, e2eEvents); eventDescriptors = descriptors; } /// /// Ensures that the event descriptors array is initialized /// static void EnsureEventDescriptors() { if (eventDescriptorsCreated) { return; } System.Threading.Monitor.Enter(syncLock); try { if (eventDescriptorsCreated) { return; } CreateEventDescriptors(); eventDescriptorsCreated = true; } finally { System.Threading.Monitor.Exit(syncLock); } } /// /// Check if ETW tracing is enabled for the particular event /// /// The index of the event descriptor static bool IsEtwEventEnabled(int eventIndex) { if (FxTrace.Trace.IsEtwProviderEnabled) { EnsureEventDescriptors(); return FxTrace.IsEventEnabled(eventIndex); } return false; } /// /// Writes ETW trace event /// /// The index of the event descriptor> /// A parameter of the ETW event> /// A parameter of the ETW event> /// A parameter of the ETW event> /// A parameter of the ETW event> /// A parameter of the ETW event> static bool WriteEtwEvent(int eventIndex, System.Runtime.Diagnostics.EventTraceActivity eventParam0, string eventParam1, string eventParam2, string eventParam3, string eventParam4) { EnsureEventDescriptors(); return FxTrace.Trace.EtwProvider.WriteEvent(ref eventDescriptors[eventIndex], eventParam0, eventParam1, eventParam2, eventParam3, eventParam4); } /// /// write a trace source into the diagnostic trace /// /// The index of the event descriptor /// The description to write /// The trace payload static void WriteTraceSource(int eventIndex, string description, TracePayload payload) { EnsureEventDescriptors(); FxTrace.Trace.WriteTraceSource(ref eventDescriptors[eventIndex], description, payload); } } }