File: TD.Designer.cs
Project: ndp\cdf\src\NetFx40\System.ServiceModel.Discovery\System.ServiceModel.Discovery.csproj (System.ServiceModel.Discovery)
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
 
namespace System.ServiceModel.Discovery
{
    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.ServiceModel.Discovery.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;
            }
        }
        
        /// <summary>
        /// Check if trace definition is enabled
        /// Event description ID=4801, Level=Warning, Channel=debug
        /// </summary>
        internal static bool DiscoveryClientInClientChannelFailedToCloseIsEnabled()
        {
            return (FxTrace.ShouldTraceWarning 
                        && (FxTrace.ShouldTraceWarningToTraceSource || TD.IsEtwEventEnabled(0)));
        }
        
        /// <summary>
        /// Gets trace definition like: The DiscoveryClient created inside DiscoveryClientChannel failed to close and hence has been aborted.
        /// Event description ID=4801, Level=Warning, Channel=debug
        /// </summary>
        /// <param name="exception">Exception associated with the event</param>
        internal static void DiscoveryClientInClientChannelFailedToClose(System.Exception exception)
        {
            TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, exception);
            if (TD.IsEtwEventEnabled(0))
            {
                TD.WriteEtwEvent(0, null, payload.SerializedException, payload.AppDomainFriendlyName);
            }
            if (FxTrace.ShouldTraceWarningToTraceSource)
            {
                string description = string.Format(Culture, ResourceManager.GetString("DiscoveryClientInClientChannelFailedToClose", Culture));
                TD.WriteTraceSource(0, description, payload);
            }
        }
        
        /// <summary>
        /// Check if trace definition is enabled
        /// Event description ID=4802, Level=Informational, Channel=debug
        /// </summary>
        internal static bool DiscoveryClientProtocolExceptionSuppressedIsEnabled()
        {
            return (FxTrace.ShouldTraceInformation 
                        && (FxTrace.ShouldTraceInformationToTraceSource || TD.IsEtwEventEnabled(1)));
        }
        
        /// <summary>
        /// Gets trace definition like: A ProtocolException was suppressed while closing the DiscoveryClient. This could be because a DiscoveryService is still trying to send response to the DiscoveryClient.
        /// Event description ID=4802, Level=Informational, Channel=debug
        /// </summary>
        /// <param name="exception">Exception associated with the event</param>
        internal static void DiscoveryClientProtocolExceptionSuppressed(System.Exception exception)
        {
            TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, exception);
            if (TD.IsEtwEventEnabled(1))
            {
                TD.WriteEtwEvent(1, null, payload.SerializedException, payload.AppDomainFriendlyName);
            }
            if (FxTrace.ShouldTraceInformationToTraceSource)
            {
                string description = string.Format(Culture, ResourceManager.GetString("DiscoveryClientProtocolExceptionSuppressed", Culture));
                TD.WriteTraceSource(1, description, payload);
            }
        }
        
        /// <summary>
        /// Check if trace definition is enabled
        /// Event description ID=4803, Level=Informational, Channel=debug
        /// </summary>
        internal static bool DiscoveryClientReceivedMulticastSuppressionIsEnabled()
        {
            return (FxTrace.ShouldTraceInformation 
                        && (FxTrace.ShouldTraceInformationToTraceSource || TD.IsEtwEventEnabled(2)));
        }
        
        /// <summary>
        /// Gets trace definition like: The DiscoveryClient received a multicast suppression message from a DiscoveryProxy.
        /// Event description ID=4803, Level=Informational, Channel=debug
        /// </summary>
        internal static void DiscoveryClientReceivedMulticastSuppression()
        {
            TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
            if (TD.IsEtwEventEnabled(2))
            {
                TD.WriteEtwEvent(2, null, payload.AppDomainFriendlyName);
            }
            if (FxTrace.ShouldTraceInformationToTraceSource)
            {
                string description = string.Format(Culture, ResourceManager.GetString("DiscoveryClientReceivedMulticastSuppression", Culture));
                TD.WriteTraceSource(2, description, payload);
            }
        }
        
        /// <summary>
        /// Check if trace definition is enabled
        /// Event description ID=4804, Level=Informational, Channel=debug
        /// </summary>
        internal static bool DiscoveryMessageReceivedAfterOperationCompletedIsEnabled()
        {
            return (FxTrace.ShouldTraceInformation 
                        && (FxTrace.ShouldTraceInformationToTraceSource || TD.IsEtwEventEnabled(3)));
        }
        
        /// <summary>
        /// Gets trace definition like: A {0} message with messageId='{1}' was dropped by the DiscoveryClient because the corresponding {2} operation was completed.
        /// Event description ID=4804, Level=Informational, Channel=debug
        /// </summary>
        /// <param name="eventTraceActivity">The event trace activity</param>
        /// <param name="discoveryMessageName">Parameter 0 for event: A {0} message with messageId='{1}' was dropped by the DiscoveryClient because the corresponding {2} operation was completed.</param>
        /// <param name="messageId">Parameter 1 for event: A {0} message with messageId='{1}' was dropped by the DiscoveryClient because the corresponding {2} operation was completed.</param>
        /// <param name="discoveryOperationName">Parameter 2 for event: A {0} message with messageId='{1}' was dropped by the DiscoveryClient because the corresponding {2} operation was completed.</param>
        internal static void DiscoveryMessageReceivedAfterOperationCompleted(System.Runtime.Diagnostics.EventTraceActivity eventTraceActivity, string discoveryMessageName, string messageId, string discoveryOperationName)
        {
            TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
            if (TD.IsEtwEventEnabled(3))
            {
                TD.WriteEtwEvent(3, eventTraceActivity, discoveryMessageName, messageId, discoveryOperationName, payload.AppDomainFriendlyName);
            }
            if (FxTrace.ShouldTraceInformationToTraceSource)
            {
                string description = string.Format(Culture, ResourceManager.GetString("DiscoveryMessageReceivedAfterOperationCompleted", Culture), discoveryMessageName, messageId, discoveryOperationName);
                TD.WriteTraceSource(3, description, payload);
            }
        }
        
        /// <summary>
        /// Check if trace definition is enabled
        /// Event description ID=4805, Level=Warning, Channel=debug
        /// </summary>
        internal static bool DiscoveryMessageWithInvalidContentIsEnabled()
        {
            return (FxTrace.ShouldTraceWarning 
                        && (FxTrace.ShouldTraceWarningToTraceSource || TD.IsEtwEventEnabled(4)));
        }
        
        /// <summary>
        /// Gets trace definition like: A {0} message with messageId='{1}' was dropped because it had invalid content.
        /// Event description ID=4805, Level=Warning, Channel=debug
        /// </summary>
        /// <param name="eventTraceActivity">The event trace activity</param>
        /// <param name="messageType">Parameter 0 for event: A {0} message with messageId='{1}' was dropped because it had invalid content.</param>
        /// <param name="messageId">Parameter 1 for event: A {0} message with messageId='{1}' was dropped because it had invalid content.</param>
        internal static void DiscoveryMessageWithInvalidContent(System.Runtime.Diagnostics.EventTraceActivity eventTraceActivity, string messageType, string messageId)
        {
            TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
            if (TD.IsEtwEventEnabled(4))
            {
                TD.WriteEtwEvent(4, eventTraceActivity, messageType, messageId, payload.AppDomainFriendlyName);
            }
            if (FxTrace.ShouldTraceWarningToTraceSource)
            {
                string description = string.Format(Culture, ResourceManager.GetString("DiscoveryMessageWithInvalidContent", Culture), messageType, messageId);
                TD.WriteTraceSource(4, description, payload);
            }
        }
        
        /// <summary>
        /// Check if trace definition is enabled
        /// Event description ID=4806, Level=Warning, Channel=debug
        /// </summary>
        internal static bool DiscoveryMessageWithInvalidRelatesToOrOperationCompletedIsEnabled()
        {
            return (FxTrace.ShouldTraceWarning 
                        && (FxTrace.ShouldTraceWarningToTraceSource || TD.IsEtwEventEnabled(5)));
        }
        
        /// <summary>
        /// Gets trace definition like: A {0} message with messageId='{1}' and relatesTo='{2}' was dropped by the DiscoveryClient because either the corresponding {3} operation was completed or the relatesTo value is invalid.
        /// Event description ID=4806, Level=Warning, Channel=debug
        /// </summary>
        /// <param name="eventTraceActivity">The event trace activity</param>
        /// <param name="discoveryMessageName">Parameter 0 for event: A {0} message with messageId='{1}' and relatesTo='{2}' was dropped by the DiscoveryClient because either the corresponding {3} operation was completed or the relatesTo value is invalid.</param>
        /// <param name="messageId">Parameter 1 for event: A {0} message with messageId='{1}' and relatesTo='{2}' was dropped by the DiscoveryClient because either the corresponding {3} operation was completed or the relatesTo value is invalid.</param>
        /// <param name="relatesTo">Parameter 2 for event: A {0} message with messageId='{1}' and relatesTo='{2}' was dropped by the DiscoveryClient because either the corresponding {3} operation was completed or the relatesTo value is invalid.</param>
        /// <param name="discoveryOperationName">Parameter 3 for event: A {0} message with messageId='{1}' and relatesTo='{2}' was dropped by the DiscoveryClient because either the corresponding {3} operation was completed or the relatesTo value is invalid.</param>
        internal static void DiscoveryMessageWithInvalidRelatesToOrOperationCompleted(System.Runtime.Diagnostics.EventTraceActivity eventTraceActivity, string discoveryMessageName, string messageId, string relatesTo, string discoveryOperationName)
        {
            TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
            if (TD.IsEtwEventEnabled(5))
            {
                TD.WriteEtwEvent(5, eventTraceActivity, discoveryMessageName, messageId, relatesTo, discoveryOperationName, payload.AppDomainFriendlyName);
            }
            if (FxTrace.ShouldTraceWarningToTraceSource)
            {
                string description = string.Format(Culture, ResourceManager.GetString("DiscoveryMessageWithInvalidRelatesToOrOperationCompleted", Culture), discoveryMessageName, messageId, relatesTo, discoveryOperationName);
                TD.WriteTraceSource(5, description, payload);
            }
        }
        
        /// <summary>
        /// Check if trace definition is enabled
        /// Event description ID=4807, Level=Warning, Channel=debug
        /// </summary>
        internal static bool DiscoveryMessageWithInvalidReplyToIsEnabled()
        {
            return (FxTrace.ShouldTraceWarning 
                        && (FxTrace.ShouldTraceWarningToTraceSource || TD.IsEtwEventEnabled(6)));
        }
        
        /// <summary>
        /// Gets trace definition like: A discovery request message with messageId='{0}' was dropped because it had an invalid ReplyTo address.
        /// Event description ID=4807, Level=Warning, Channel=debug
        /// </summary>
        /// <param name="eventTraceActivity">The event trace activity</param>
        /// <param name="messageId">Parameter 0 for event: A discovery request message with messageId='{0}' was dropped because it had an invalid ReplyTo address.</param>
        internal static void DiscoveryMessageWithInvalidReplyTo(System.Runtime.Diagnostics.EventTraceActivity eventTraceActivity, string messageId)
        {
            TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
            if (TD.IsEtwEventEnabled(6))
            {
                TD.WriteEtwEvent(6, eventTraceActivity, messageId, payload.AppDomainFriendlyName);
            }
            if (FxTrace.ShouldTraceWarningToTraceSource)
            {
                string description = string.Format(Culture, ResourceManager.GetString("DiscoveryMessageWithInvalidReplyTo", Culture), messageId);
                TD.WriteTraceSource(6, description, payload);
            }
        }
        
        /// <summary>
        /// Check if trace definition is enabled
        /// Event description ID=4808, Level=Warning, Channel=debug
        /// </summary>
        internal static bool DiscoveryMessageWithNoContentIsEnabled()
        {
            return (FxTrace.ShouldTraceWarning 
                        && (FxTrace.ShouldTraceWarningToTraceSource || TD.IsEtwEventEnabled(7)));
        }
        
        /// <summary>
        /// Gets trace definition like: A {0} message was dropped because it did not have any content.
        /// Event description ID=4808, Level=Warning, Channel=debug
        /// </summary>
        /// <param name="eventTraceActivity">The event trace activity</param>
        /// <param name="messageType">Parameter 0 for event: A {0} message was dropped because it did not have any content.</param>
        internal static void DiscoveryMessageWithNoContent(System.Runtime.Diagnostics.EventTraceActivity eventTraceActivity, string messageType)
        {
            TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
            if (TD.IsEtwEventEnabled(7))
            {
                TD.WriteEtwEvent(7, eventTraceActivity, messageType, payload.AppDomainFriendlyName);
            }
            if (FxTrace.ShouldTraceWarningToTraceSource)
            {
                string description = string.Format(Culture, ResourceManager.GetString("DiscoveryMessageWithNoContent", Culture), messageType);
                TD.WriteTraceSource(7, description, payload);
            }
        }
        
        /// <summary>
        /// Check if trace definition is enabled
        /// Event description ID=4809, Level=Warning, Channel=debug
        /// </summary>
        internal static bool DiscoveryMessageWithNullMessageIdIsEnabled()
        {
            return (FxTrace.ShouldTraceWarning 
                        && (FxTrace.ShouldTraceWarningToTraceSource || TD.IsEtwEventEnabled(8)));
        }
        
        /// <summary>
        /// Gets trace definition like: A {0} message was dropped because the message header did not contain the required MessageId property.
        /// Event description ID=4809, Level=Warning, Channel=debug
        /// </summary>
        /// <param name="eventTraceActivity">The event trace activity</param>
        /// <param name="messageType">Parameter 0 for event: A {0} message was dropped because the message header did not contain the required MessageId property.</param>
        internal static void DiscoveryMessageWithNullMessageId(System.Runtime.Diagnostics.EventTraceActivity eventTraceActivity, string messageType)
        {
            TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
            if (TD.IsEtwEventEnabled(8))
            {
                TD.WriteEtwEvent(8, eventTraceActivity, messageType, payload.AppDomainFriendlyName);
            }
            if (FxTrace.ShouldTraceWarningToTraceSource)
            {
                string description = string.Format(Culture, ResourceManager.GetString("DiscoveryMessageWithNullMessageId", Culture), messageType);
                TD.WriteTraceSource(8, description, payload);
            }
        }
        
        /// <summary>
        /// Check if trace definition is enabled
        /// Event description ID=4810, Level=Warning, Channel=debug
        /// </summary>
        internal static bool DiscoveryMessageWithNullMessageSequenceIsEnabled()
        {
            return (FxTrace.ShouldTraceWarning 
                        && (FxTrace.ShouldTraceWarningToTraceSource || TD.IsEtwEventEnabled(9)));
        }
        
        /// <summary>
        /// Gets trace definition like: A {0} message with messageId='{1}' was dropped by the DiscoveryClient because it did not have the DiscoveryMessageSequence property.
        /// Event description ID=4810, Level=Warning, Channel=debug
        /// </summary>
        /// <param name="discoveryMessageName">Parameter 0 for event: A {0} message with messageId='{1}' was dropped by the DiscoveryClient because it did not have the DiscoveryMessageSequence property.</param>
        /// <param name="messageId">Parameter 1 for event: A {0} message with messageId='{1}' was dropped by the DiscoveryClient because it did not have the DiscoveryMessageSequence property.</param>
        internal static void DiscoveryMessageWithNullMessageSequence(string discoveryMessageName, string messageId)
        {
            TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
            if (TD.IsEtwEventEnabled(9))
            {
                TD.WriteEtwEvent(9, null, discoveryMessageName, messageId, payload.AppDomainFriendlyName);
            }
            if (FxTrace.ShouldTraceWarningToTraceSource)
            {
                string description = string.Format(Culture, ResourceManager.GetString("DiscoveryMessageWithNullMessageSequence", Culture), discoveryMessageName, messageId);
                TD.WriteTraceSource(9, description, payload);
            }
        }
        
        /// <summary>
        /// Check if trace definition is enabled
        /// Event description ID=4811, Level=Warning, Channel=debug
        /// </summary>
        internal static bool DiscoveryMessageWithNullRelatesToIsEnabled()
        {
            return (FxTrace.ShouldTraceWarning 
                        && (FxTrace.ShouldTraceWarningToTraceSource || TD.IsEtwEventEnabled(10)));
        }
        
        /// <summary>
        /// Gets trace definition like: A {0} message with messageId='{1}' was dropped by the DiscoveryClient because the message header did not contain the required RelatesTo property.
        /// Event description ID=4811, Level=Warning, Channel=debug
        /// </summary>
        /// <param name="eventTraceActivity">The event trace activity</param>
        /// <param name="discoveryMessageName">Parameter 0 for event: A {0} message with messageId='{1}' was dropped by the DiscoveryClient because the message header did not contain the required RelatesTo property.</param>
        /// <param name="messageId">Parameter 1 for event: A {0} message with messageId='{1}' was dropped by the DiscoveryClient because the message header did not contain the required RelatesTo property.</param>
        internal static void DiscoveryMessageWithNullRelatesTo(System.Runtime.Diagnostics.EventTraceActivity eventTraceActivity, string discoveryMessageName, string messageId)
        {
            TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
            if (TD.IsEtwEventEnabled(10))
            {
                TD.WriteEtwEvent(10, eventTraceActivity, discoveryMessageName, messageId, payload.AppDomainFriendlyName);
            }
            if (FxTrace.ShouldTraceWarningToTraceSource)
            {
                string description = string.Format(Culture, ResourceManager.GetString("DiscoveryMessageWithNullRelatesTo", Culture), discoveryMessageName, messageId);
                TD.WriteTraceSource(10, description, payload);
            }
        }
        
        /// <summary>
        /// Check if trace definition is enabled
        /// Event description ID=4812, Level=Warning, Channel=debug
        /// </summary>
        internal static bool DiscoveryMessageWithNullReplyToIsEnabled()
        {
            return (FxTrace.ShouldTraceWarning 
                        && (FxTrace.ShouldTraceWarningToTraceSource || TD.IsEtwEventEnabled(11)));
        }
        
        /// <summary>
        /// Gets trace definition like: A discovery request message with messageId='{0}' was dropped because it did not have a ReplyTo address.
        /// Event description ID=4812, Level=Warning, Channel=debug
        /// </summary>
        /// <param name="eventTraceActivity">The event trace activity</param>
        /// <param name="messageId">Parameter 0 for event: A discovery request message with messageId='{0}' was dropped because it did not have a ReplyTo address.</param>
        internal static void DiscoveryMessageWithNullReplyTo(System.Runtime.Diagnostics.EventTraceActivity eventTraceActivity, string messageId)
        {
            TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
            if (TD.IsEtwEventEnabled(11))
            {
                TD.WriteEtwEvent(11, eventTraceActivity, messageId, payload.AppDomainFriendlyName);
            }
            if (FxTrace.ShouldTraceWarningToTraceSource)
            {
                string description = string.Format(Culture, ResourceManager.GetString("DiscoveryMessageWithNullReplyTo", Culture), messageId);
                TD.WriteTraceSource(11, description, payload);
            }
        }
        
        /// <summary>
        /// Check if trace definition is enabled
        /// Event description ID=4813, Level=Warning, Channel=debug
        /// </summary>
        internal static bool DuplicateDiscoveryMessageIsEnabled()
        {
            return (FxTrace.ShouldTraceWarning 
                        && (FxTrace.ShouldTraceWarningToTraceSource || TD.IsEtwEventEnabled(12)));
        }
        
        /// <summary>
        /// Gets trace definition like: A {0} message with messageId='{1}' was dropped because it was a duplicate.
        /// Event description ID=4813, Level=Warning, Channel=debug
        /// </summary>
        /// <param name="eventTraceActivity">The event trace activity</param>
        /// <param name="messageType">Parameter 0 for event: A {0} message with messageId='{1}' was dropped because it was a duplicate.</param>
        /// <param name="messageId">Parameter 1 for event: A {0} message with messageId='{1}' was dropped because it was a duplicate.</param>
        internal static void DuplicateDiscoveryMessage(System.Runtime.Diagnostics.EventTraceActivity eventTraceActivity, string messageType, string messageId)
        {
            TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
            if (TD.IsEtwEventEnabled(12))
            {
                TD.WriteEtwEvent(12, eventTraceActivity, messageType, messageId, payload.AppDomainFriendlyName);
            }
            if (FxTrace.ShouldTraceWarningToTraceSource)
            {
                string description = string.Format(Culture, ResourceManager.GetString("DuplicateDiscoveryMessage", Culture), messageType, messageId);
                TD.WriteTraceSource(12, description, payload);
            }
        }
        
        /// <summary>
        /// Check if trace definition is enabled
        /// Event description ID=4814, Level=Informational, Channel=debug
        /// </summary>
        internal static bool EndpointDiscoverabilityDisabledIsEnabled()
        {
            return (FxTrace.ShouldTraceInformation 
                        && (FxTrace.ShouldTraceInformationToTraceSource || TD.IsEtwEventEnabled(13)));
        }
        
        /// <summary>
        /// Gets trace definition like: The discoverability of endpoint with EndpointAddress='{0}' and ListenUri='{1}' has been disabled.
        /// Event description ID=4814, Level=Informational, Channel=debug
        /// </summary>
        /// <param name="endpointAddress">Parameter 0 for event: The discoverability of endpoint with EndpointAddress='{0}' and ListenUri='{1}' has been disabled.</param>
        /// <param name="listenUri">Parameter 1 for event: The discoverability of endpoint with EndpointAddress='{0}' and ListenUri='{1}' has been disabled.</param>
        internal static void EndpointDiscoverabilityDisabled(string endpointAddress, string listenUri)
        {
            TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
            if (TD.IsEtwEventEnabled(13))
            {
                TD.WriteEtwEvent(13, null, endpointAddress, listenUri, payload.AppDomainFriendlyName);
            }
            if (FxTrace.ShouldTraceInformationToTraceSource)
            {
                string description = string.Format(Culture, ResourceManager.GetString("EndpointDiscoverabilityDisabled", Culture), endpointAddress, listenUri);
                TD.WriteTraceSource(13, description, payload);
            }
        }
        
        /// <summary>
        /// Check if trace definition is enabled
        /// Event description ID=4815, Level=Informational, Channel=debug
        /// </summary>
        internal static bool EndpointDiscoverabilityEnabledIsEnabled()
        {
            return (FxTrace.ShouldTraceInformation 
                        && (FxTrace.ShouldTraceInformationToTraceSource || TD.IsEtwEventEnabled(14)));
        }
        
        /// <summary>
        /// Gets trace definition like: The discoverability of endpoint with EndpointAddress='{0}' and ListenUri='{1}' has been enabled.
        /// Event description ID=4815, Level=Informational, Channel=debug
        /// </summary>
        /// <param name="endpointAddress">Parameter 0 for event: The discoverability of endpoint with EndpointAddress='{0}' and ListenUri='{1}' has been enabled.</param>
        /// <param name="listenUri">Parameter 1 for event: The discoverability of endpoint with EndpointAddress='{0}' and ListenUri='{1}' has been enabled.</param>
        internal static void EndpointDiscoverabilityEnabled(string endpointAddress, string listenUri)
        {
            TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
            if (TD.IsEtwEventEnabled(14))
            {
                TD.WriteEtwEvent(14, null, endpointAddress, listenUri, payload.AppDomainFriendlyName);
            }
            if (FxTrace.ShouldTraceInformationToTraceSource)
            {
                string description = string.Format(Culture, ResourceManager.GetString("EndpointDiscoverabilityEnabled", Culture), endpointAddress, listenUri);
                TD.WriteTraceSource(14, description, payload);
            }
        }
        
        /// <summary>
        /// Check if trace definition is enabled
        /// Event description ID=4816, Level=Verbose, Channel=debug
        /// </summary>
        internal static bool FindInitiatedInDiscoveryClientChannelIsEnabled()
        {
            return (FxTrace.ShouldTraceVerbose 
                        && (FxTrace.ShouldTraceVerboseToTraceSource || TD.IsEtwEventEnabled(15)));
        }
        
        /// <summary>
        /// Gets trace definition like: A Find operation was initiated in the DiscoveryClientChannel to discover endpoint(s).
        /// Event description ID=4816, Level=Verbose, Channel=debug
        /// </summary>
        internal static void FindInitiatedInDiscoveryClientChannel()
        {
            TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
            if (TD.IsEtwEventEnabled(15))
            {
                TD.WriteEtwEvent(15, null, payload.AppDomainFriendlyName);
            }
            if (FxTrace.ShouldTraceVerboseToTraceSource)
            {
                string description = string.Format(Culture, ResourceManager.GetString("FindInitiatedInDiscoveryClientChannel", Culture));
                TD.WriteTraceSource(15, description, payload);
            }
        }
        
        /// <summary>
        /// Check if trace definition is enabled
        /// Event description ID=4817, Level=Warning, Channel=debug
        /// </summary>
        internal static bool InnerChannelCreationFailedIsEnabled()
        {
            return (FxTrace.ShouldTraceWarning 
                        && (FxTrace.ShouldTraceWarningToTraceSource || TD.IsEtwEventEnabled(16)));
        }
        
        /// <summary>
        /// Gets trace definition like: The DiscoveryClientChannel failed to create the channel with a discovered endpoint with EndpointAddress='{0}' and Via='{1}'. The DiscoveryClientChannel will now attempt to use the next available discovered endpoint.
        /// Event description ID=4817, Level=Warning, Channel=debug
        /// </summary>
        /// <param name="endpointAddress">Parameter 0 for event: The DiscoveryClientChannel failed to create the channel with a discovered endpoint with EndpointAddress='{0}' and Via='{1}'. The DiscoveryClientChannel will now attempt to use the next available discovered endpoint.</param>
        /// <param name="via">Parameter 1 for event: The DiscoveryClientChannel failed to create the channel with a discovered endpoint with EndpointAddress='{0}' and Via='{1}'. The DiscoveryClientChannel will now attempt to use the next available discovered endpoint.</param>
        /// <param name="exception">Exception associated with the event</param>
        internal static void InnerChannelCreationFailed(string endpointAddress, string via, System.Exception exception)
        {
            TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, exception);
            if (TD.IsEtwEventEnabled(16))
            {
                TD.WriteEtwEvent(16, null, endpointAddress, via, payload.SerializedException, payload.AppDomainFriendlyName);
            }
            if (FxTrace.ShouldTraceWarningToTraceSource)
            {
                string description = string.Format(Culture, ResourceManager.GetString("InnerChannelCreationFailed", Culture), endpointAddress, via);
                TD.WriteTraceSource(16, description, payload);
            }
        }
        
        /// <summary>
        /// Check if trace definition is enabled
        /// Event description ID=4818, Level=Warning, Channel=debug
        /// </summary>
        internal static bool InnerChannelOpenFailedIsEnabled()
        {
            return (FxTrace.ShouldTraceWarning 
                        && (FxTrace.ShouldTraceWarningToTraceSource || TD.IsEtwEventEnabled(17)));
        }
        
        /// <summary>
        /// Gets trace definition like: The DiscoveryClientChannel failed to open the channel with a discovered endpoint with EndpointAddress='{0}' and Via='{1}'. The DiscoveryClientChannel will now attempt to use the next available discovered endpoint.
        /// Event description ID=4818, Level=Warning, Channel=debug
        /// </summary>
        /// <param name="endpointAddress">Parameter 0 for event: The DiscoveryClientChannel failed to open the channel with a discovered endpoint with EndpointAddress='{0}' and Via='{1}'. The DiscoveryClientChannel will now attempt to use the next available discovered endpoint.</param>
        /// <param name="via">Parameter 1 for event: The DiscoveryClientChannel failed to open the channel with a discovered endpoint with EndpointAddress='{0}' and Via='{1}'. The DiscoveryClientChannel will now attempt to use the next available discovered endpoint.</param>
        /// <param name="exception">Exception associated with the event</param>
        internal static void InnerChannelOpenFailed(string endpointAddress, string via, System.Exception exception)
        {
            TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, exception);
            if (TD.IsEtwEventEnabled(17))
            {
                TD.WriteEtwEvent(17, null, endpointAddress, via, payload.SerializedException, payload.AppDomainFriendlyName);
            }
            if (FxTrace.ShouldTraceWarningToTraceSource)
            {
                string description = string.Format(Culture, ResourceManager.GetString("InnerChannelOpenFailed", Culture), endpointAddress, via);
                TD.WriteTraceSource(17, description, payload);
            }
        }
        
        /// <summary>
        /// Check if trace definition is enabled
        /// Event description ID=4819, Level=Informational, Channel=debug
        /// </summary>
        internal static bool InnerChannelOpenSucceededIsEnabled()
        {
            return (FxTrace.ShouldTraceInformation 
                        && (FxTrace.ShouldTraceInformationToTraceSource || TD.IsEtwEventEnabled(18)));
        }
        
        /// <summary>
        /// Gets trace definition like: The DiscoveryClientChannel successfully discovered an endpoint and opened the channel using it. The client is connected to a service using EndpointAddress='{0}' and Via='{1}'.
        /// Event description ID=4819, Level=Informational, Channel=debug
        /// </summary>
        /// <param name="endpointAddress">Parameter 0 for event: The DiscoveryClientChannel successfully discovered an endpoint and opened the channel using it. The client is connected to a service using EndpointAddress='{0}' and Via='{1}'.</param>
        /// <param name="via">Parameter 1 for event: The DiscoveryClientChannel successfully discovered an endpoint and opened the channel using it. The client is connected to a service using EndpointAddress='{0}' and Via='{1}'.</param>
        internal static void InnerChannelOpenSucceeded(string endpointAddress, string via)
        {
            TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
            if (TD.IsEtwEventEnabled(18))
            {
                TD.WriteEtwEvent(18, null, endpointAddress, via, payload.AppDomainFriendlyName);
            }
            if (FxTrace.ShouldTraceInformationToTraceSource)
            {
                string description = string.Format(Culture, ResourceManager.GetString("InnerChannelOpenSucceeded", Culture), endpointAddress, via);
                TD.WriteTraceSource(18, description, payload);
            }
        }
        
        /// <summary>
        /// Check if trace definition is enabled
        /// Event description ID=4820, Level=Informational, Channel=debug
        /// </summary>
        internal static bool SynchronizationContextResetIsEnabled()
        {
            return (FxTrace.ShouldTraceInformation 
                        && (FxTrace.ShouldTraceInformationToTraceSource || TD.IsEtwEventEnabled(19)));
        }
        
        /// <summary>
        /// Gets trace definition like: The SynchronizationContext has been reset to its original value of {0} by DiscoveryClientChannel.
        /// Event description ID=4820, Level=Informational, Channel=debug
        /// </summary>
        /// <param name="synchronizationContextType">Parameter 0 for event: The SynchronizationContext has been reset to its original value of {0} by DiscoveryClientChannel.</param>
        internal static void SynchronizationContextReset(string synchronizationContextType)
        {
            TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
            if (TD.IsEtwEventEnabled(19))
            {
                TD.WriteEtwEvent(19, null, synchronizationContextType, payload.AppDomainFriendlyName);
            }
            if (FxTrace.ShouldTraceInformationToTraceSource)
            {
                string description = string.Format(Culture, ResourceManager.GetString("SynchronizationContextReset", Culture), synchronizationContextType);
                TD.WriteTraceSource(19, description, payload);
            }
        }
        
        /// <summary>
        /// Check if trace definition is enabled
        /// Event description ID=4821, Level=Informational, Channel=debug
        /// </summary>
        internal static bool SynchronizationContextSetToNullIsEnabled()
        {
            return (FxTrace.ShouldTraceInformation 
                        && (FxTrace.ShouldTraceInformationToTraceSource || TD.IsEtwEventEnabled(20)));
        }
        
        /// <summary>
        /// Gets trace definition like: The SynchronizationContext has been set to null by DiscoveryClientChannel before initiating the Find operation.
        /// Event description ID=4821, Level=Informational, Channel=debug
        /// </summary>
        internal static void SynchronizationContextSetToNull()
        {
            TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
            if (TD.IsEtwEventEnabled(20))
            {
                TD.WriteEtwEvent(20, null, payload.AppDomainFriendlyName);
            }
            if (FxTrace.ShouldTraceInformationToTraceSource)
            {
                string description = string.Format(Culture, ResourceManager.GetString("SynchronizationContextSetToNull", Culture));
                TD.WriteTraceSource(20, description, payload);
            }
        }
        
        /// <summary>
        /// Creates the event descriptors array
        /// </summary>
        static void CreateEventDescriptors()
        {
            System.Runtime.Diagnostics.EventDescriptor[] descriptors = new System.Runtime.Diagnostics.EventDescriptor[] {
                    new System.Runtime.Diagnostics.EventDescriptor(4801, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Warning, (byte)30, 0x9e1, 0x1000000000004000),
                    new System.Runtime.Diagnostics.EventDescriptor(4802, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Informational, (byte)29, 0x9e1, 0x1000000000004000),
                    new System.Runtime.Diagnostics.EventDescriptor(4803, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Informational, (byte)31, 0x9e1, 0x1000000000004000),
                    new System.Runtime.Diagnostics.EventDescriptor(4804, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Informational, (byte)45, 0x9e3, 0x1000000000004000),
                    new System.Runtime.Diagnostics.EventDescriptor(4805, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Warning, (byte)37, 0x9e3, 0x1000000000004000),
                    new System.Runtime.Diagnostics.EventDescriptor(4806, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Warning, (byte)38, 0x9e3, 0x1000000000004000),
                    new System.Runtime.Diagnostics.EventDescriptor(4807, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Warning, (byte)39, 0x9e3, 0x1000000000004000),
                    new System.Runtime.Diagnostics.EventDescriptor(4808, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Warning, (byte)40, 0x9e3, 0x1000000000004000),
                    new System.Runtime.Diagnostics.EventDescriptor(4809, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Warning, (byte)41, 0x9e3, 0x1000000000004000),
                    new System.Runtime.Diagnostics.EventDescriptor(4810, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Warning, (byte)42, 0x9e3, 0x1000000000004000),
                    new System.Runtime.Diagnostics.EventDescriptor(4811, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Warning, (byte)43, 0x9e3, 0x1000000000004000),
                    new System.Runtime.Diagnostics.EventDescriptor(4812, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Warning, (byte)44, 0x9e3, 0x1000000000004000),
                    new System.Runtime.Diagnostics.EventDescriptor(4813, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Warning, (byte)36, 0x9e3, 0x1000000000004000),
                    new System.Runtime.Diagnostics.EventDescriptor(4814, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Informational, (byte)58, 0x9e6, 0x1000000000004000),
                    new System.Runtime.Diagnostics.EventDescriptor(4815, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Informational, (byte)59, 0x9e6, 0x1000000000004000),
                    new System.Runtime.Diagnostics.EventDescriptor(4816, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Verbose, (byte)33, 0x9e2, 0x1000000000004000),
                    new System.Runtime.Diagnostics.EventDescriptor(4817, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Warning, (byte)32, 0x9e2, 0x1000000000004000),
                    new System.Runtime.Diagnostics.EventDescriptor(4818, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Warning, (byte)34, 0x9e2, 0x1000000000004000),
                    new System.Runtime.Diagnostics.EventDescriptor(4819, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Informational, (byte)35, 0x9e2, 0x1000000000004000),
                    new System.Runtime.Diagnostics.EventDescriptor(4820, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Informational, (byte)46, 0x9e4, 0x1000000000004000),
                    new System.Runtime.Diagnostics.EventDescriptor(4821, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Informational, (byte)47, 0x9e4, 0x1000000000004000)};
            ushort[] e2eEvents = new ushort[] {
                    4804,
                    4805,
                    4806,
                    4807,
                    4808,
                    4809,
                    4811,
                    4812,
                    4813};
            FxTrace.UpdateEventDefinitions(descriptors, e2eEvents);
            eventDescriptors = descriptors;
        }
        
        /// <summary>
        /// Ensures that the event descriptors array is initialized
        /// </summary>
        static void EnsureEventDescriptors()
        {
            if (eventDescriptorsCreated)
            {
                return;
            }
            System.Threading.Monitor.Enter(syncLock);
            try
            {
                if (eventDescriptorsCreated)
                {
                    return;
                }
                CreateEventDescriptors();
                eventDescriptorsCreated = true;
            }
            finally
            {
                System.Threading.Monitor.Exit(syncLock);
            }
        }
        
        /// <summary>
        /// Check if ETW tracing is enabled for the particular event
        /// </summary>
        /// <param name="eventIndex">The index of the event descriptor</param>
        static bool IsEtwEventEnabled(int eventIndex)
        {
            if (FxTrace.Trace.IsEtwProviderEnabled)
            {
                EnsureEventDescriptors();
                return FxTrace.IsEventEnabled(eventIndex);
            }
            return false;
        }
        
        /// <summary>
        /// Writes ETW trace event
        ///</summary>
        /// <param name="eventIndex">The index of the event descriptor</param>>
        /// <param name="eventParam0">A parameter of the ETW event</param>>
        /// <param name="eventParam1">A parameter of the ETW event</param>>
        /// <param name="eventParam2">A parameter of the ETW event</param>>
        static bool WriteEtwEvent(int eventIndex, System.Runtime.Diagnostics.EventTraceActivity eventParam0, string eventParam1, string eventParam2)
        {
            EnsureEventDescriptors();
            return FxTrace.Trace.EtwProvider.WriteEvent(ref eventDescriptors[eventIndex], eventParam0, eventParam1, eventParam2);
        }
        
        /// <summary>
        /// Writes ETW trace event
        ///</summary>
        /// <param name="eventIndex">The index of the event descriptor</param>>
        /// <param name="eventParam0">A parameter of the ETW event</param>>
        /// <param name="eventParam1">A parameter of the ETW event</param>>
        static bool WriteEtwEvent(int eventIndex, System.Runtime.Diagnostics.EventTraceActivity eventParam0, string eventParam1)
        {
            EnsureEventDescriptors();
            return FxTrace.Trace.EtwProvider.WriteEvent(ref eventDescriptors[eventIndex], eventParam0, eventParam1);
        }
        
        /// <summary>
        /// Writes ETW trace event
        ///</summary>
        /// <param name="eventIndex">The index of the event descriptor</param>>
        /// <param name="eventParam0">A parameter of the ETW event</param>>
        /// <param name="eventParam1">A parameter of the ETW event</param>>
        /// <param name="eventParam2">A parameter of the ETW event</param>>
        /// <param name="eventParam3">A parameter of the ETW event</param>>
        /// <param name="eventParam4">A parameter of the ETW event</param>>
        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);
        }
        
        /// <summary>
        /// Writes ETW trace event
        ///</summary>
        /// <param name="eventIndex">The index of the event descriptor</param>>
        /// <param name="eventParam0">A parameter of the ETW event</param>>
        /// <param name="eventParam1">A parameter of the ETW event</param>>
        /// <param name="eventParam2">A parameter of the ETW event</param>>
        /// <param name="eventParam3">A parameter of the ETW event</param>>
        static bool WriteEtwEvent(int eventIndex, System.Runtime.Diagnostics.EventTraceActivity eventParam0, string eventParam1, string eventParam2, string eventParam3)
        {
            EnsureEventDescriptors();
            return FxTrace.Trace.EtwProvider.WriteEvent(ref eventDescriptors[eventIndex], eventParam0, eventParam1, eventParam2, eventParam3);
        }
        
        /// <summary>
        /// Writes ETW trace event
        ///</summary>
        /// <param name="eventIndex">The index of the event descriptor</param>>
        /// <param name="eventParam0">A parameter of the ETW event</param>>
        /// <param name="eventParam1">A parameter of the ETW event</param>>
        /// <param name="eventParam2">A parameter of the ETW event</param>>
        /// <param name="eventParam3">A parameter of the ETW event</param>>
        /// <param name="eventParam4">A parameter of the ETW event</param>>
        /// <param name="eventParam5">A parameter of the ETW event</param>>
        static bool WriteEtwEvent(int eventIndex, System.Runtime.Diagnostics.EventTraceActivity eventParam0, string eventParam1, string eventParam2, string eventParam3, string eventParam4, string eventParam5)
        {
            EnsureEventDescriptors();
            return FxTrace.Trace.EtwProvider.WriteEvent(ref eventDescriptors[eventIndex], eventParam0, eventParam1, eventParam2, eventParam3, eventParam4, eventParam5);
        }
        
        /// <summary>
        /// write a trace source into the diagnostic trace
        /// </summary>
        /// <param name="eventIndex">The index of the event descriptor</param>
        /// <param name="description">The description to write</param>
        /// <param name="payload">The trace payload</param>
        static void WriteTraceSource(int eventIndex, string description, TracePayload payload)
        {
            EnsureEventDescriptors();
            FxTrace.Trace.WriteTraceSource(ref eventDescriptors[eventIndex], description, payload);
        }
    }
}