1 //------------------------------------------------------------------------------
3 // This code was generated by a tool.
5 // Changes to this file may cause incorrect behavior and will be lost if
6 // the code is regenerated.
8 //------------------------------------------------------------------------------
10 namespace System.ServiceModel.Discovery
13 using System.Runtime.Diagnostics;
14 using System.Security;
17 internal partial class TD
20 static System.Resources.ResourceManager resourceManager;
22 static System.Globalization.CultureInfo resourceCulture;
24 [System.Security.SecurityCriticalAttribute()]
25 static System.Runtime.Diagnostics.EventDescriptor[] eventDescriptors;
27 static object syncLock = new object();
29 // Double-checked locking pattern requires volatile for read/write synchronization
30 static volatile bool eventDescriptorsCreated;
36 [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification="This is an auto-generated code, some ETW/TraceSource mixed code would use it.")]
37 static System.Resources.ResourceManager ResourceManager
41 if (object.ReferenceEquals(resourceManager, null))
43 resourceManager = new System.Resources.ResourceManager("System.ServiceModel.Discovery.TD", typeof(TD).Assembly);
45 return resourceManager;
49 [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification="This template is shared across all assemblies, some of which use this accessor.")]
50 internal static System.Globalization.CultureInfo Culture
54 return resourceCulture;
58 resourceCulture = value;
63 /// Check if trace definition is enabled
64 /// Event description ID=4801, Level=Warning, Channel=debug
66 internal static bool DiscoveryClientInClientChannelFailedToCloseIsEnabled()
68 return (FxTrace.ShouldTraceWarning
69 && (FxTrace.ShouldTraceWarningToTraceSource || TD.IsEtwEventEnabled(0)));
73 /// Gets trace definition like: The DiscoveryClient created inside DiscoveryClientChannel failed to close and hence has been aborted.
74 /// Event description ID=4801, Level=Warning, Channel=debug
76 /// <param name="exception">Exception associated with the event</param>
77 internal static void DiscoveryClientInClientChannelFailedToClose(System.Exception exception)
79 TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, exception);
80 if (TD.IsEtwEventEnabled(0))
82 TD.WriteEtwEvent(0, null, payload.SerializedException, payload.AppDomainFriendlyName);
84 if (FxTrace.ShouldTraceWarningToTraceSource)
86 string description = string.Format(Culture, ResourceManager.GetString("DiscoveryClientInClientChannelFailedToClose", Culture));
87 TD.WriteTraceSource(0, description, payload);
92 /// Check if trace definition is enabled
93 /// Event description ID=4802, Level=Informational, Channel=debug
95 internal static bool DiscoveryClientProtocolExceptionSuppressedIsEnabled()
97 return (FxTrace.ShouldTraceInformation
98 && (FxTrace.ShouldTraceInformationToTraceSource || TD.IsEtwEventEnabled(1)));
102 /// 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.
103 /// Event description ID=4802, Level=Informational, Channel=debug
105 /// <param name="exception">Exception associated with the event</param>
106 internal static void DiscoveryClientProtocolExceptionSuppressed(System.Exception exception)
108 TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, exception);
109 if (TD.IsEtwEventEnabled(1))
111 TD.WriteEtwEvent(1, null, payload.SerializedException, payload.AppDomainFriendlyName);
113 if (FxTrace.ShouldTraceInformationToTraceSource)
115 string description = string.Format(Culture, ResourceManager.GetString("DiscoveryClientProtocolExceptionSuppressed", Culture));
116 TD.WriteTraceSource(1, description, payload);
121 /// Check if trace definition is enabled
122 /// Event description ID=4803, Level=Informational, Channel=debug
124 internal static bool DiscoveryClientReceivedMulticastSuppressionIsEnabled()
126 return (FxTrace.ShouldTraceInformation
127 && (FxTrace.ShouldTraceInformationToTraceSource || TD.IsEtwEventEnabled(2)));
131 /// Gets trace definition like: The DiscoveryClient received a multicast suppression message from a DiscoveryProxy.
132 /// Event description ID=4803, Level=Informational, Channel=debug
134 internal static void DiscoveryClientReceivedMulticastSuppression()
136 TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
137 if (TD.IsEtwEventEnabled(2))
139 TD.WriteEtwEvent(2, null, payload.AppDomainFriendlyName);
141 if (FxTrace.ShouldTraceInformationToTraceSource)
143 string description = string.Format(Culture, ResourceManager.GetString("DiscoveryClientReceivedMulticastSuppression", Culture));
144 TD.WriteTraceSource(2, description, payload);
149 /// Check if trace definition is enabled
150 /// Event description ID=4804, Level=Informational, Channel=debug
152 internal static bool DiscoveryMessageReceivedAfterOperationCompletedIsEnabled()
154 return (FxTrace.ShouldTraceInformation
155 && (FxTrace.ShouldTraceInformationToTraceSource || TD.IsEtwEventEnabled(3)));
159 /// Gets trace definition like: A {0} message with messageId='{1}' was dropped by the DiscoveryClient because the corresponding {2} operation was completed.
160 /// Event description ID=4804, Level=Informational, Channel=debug
162 /// <param name="eventTraceActivity">The event trace activity</param>
163 /// <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>
164 /// <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>
165 /// <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>
166 internal static void DiscoveryMessageReceivedAfterOperationCompleted(System.Runtime.Diagnostics.EventTraceActivity eventTraceActivity, string discoveryMessageName, string messageId, string discoveryOperationName)
168 TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
169 if (TD.IsEtwEventEnabled(3))
171 TD.WriteEtwEvent(3, eventTraceActivity, discoveryMessageName, messageId, discoveryOperationName, payload.AppDomainFriendlyName);
173 if (FxTrace.ShouldTraceInformationToTraceSource)
175 string description = string.Format(Culture, ResourceManager.GetString("DiscoveryMessageReceivedAfterOperationCompleted", Culture), discoveryMessageName, messageId, discoveryOperationName);
176 TD.WriteTraceSource(3, description, payload);
181 /// Check if trace definition is enabled
182 /// Event description ID=4805, Level=Warning, Channel=debug
184 internal static bool DiscoveryMessageWithInvalidContentIsEnabled()
186 return (FxTrace.ShouldTraceWarning
187 && (FxTrace.ShouldTraceWarningToTraceSource || TD.IsEtwEventEnabled(4)));
191 /// Gets trace definition like: A {0} message with messageId='{1}' was dropped because it had invalid content.
192 /// Event description ID=4805, Level=Warning, Channel=debug
194 /// <param name="eventTraceActivity">The event trace activity</param>
195 /// <param name="messageType">Parameter 0 for event: A {0} message with messageId='{1}' was dropped because it had invalid content.</param>
196 /// <param name="messageId">Parameter 1 for event: A {0} message with messageId='{1}' was dropped because it had invalid content.</param>
197 internal static void DiscoveryMessageWithInvalidContent(System.Runtime.Diagnostics.EventTraceActivity eventTraceActivity, string messageType, string messageId)
199 TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
200 if (TD.IsEtwEventEnabled(4))
202 TD.WriteEtwEvent(4, eventTraceActivity, messageType, messageId, payload.AppDomainFriendlyName);
204 if (FxTrace.ShouldTraceWarningToTraceSource)
206 string description = string.Format(Culture, ResourceManager.GetString("DiscoveryMessageWithInvalidContent", Culture), messageType, messageId);
207 TD.WriteTraceSource(4, description, payload);
212 /// Check if trace definition is enabled
213 /// Event description ID=4806, Level=Warning, Channel=debug
215 internal static bool DiscoveryMessageWithInvalidRelatesToOrOperationCompletedIsEnabled()
217 return (FxTrace.ShouldTraceWarning
218 && (FxTrace.ShouldTraceWarningToTraceSource || TD.IsEtwEventEnabled(5)));
222 /// 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.
223 /// Event description ID=4806, Level=Warning, Channel=debug
225 /// <param name="eventTraceActivity">The event trace activity</param>
226 /// <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>
227 /// <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>
228 /// <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>
229 /// <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>
230 internal static void DiscoveryMessageWithInvalidRelatesToOrOperationCompleted(System.Runtime.Diagnostics.EventTraceActivity eventTraceActivity, string discoveryMessageName, string messageId, string relatesTo, string discoveryOperationName)
232 TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
233 if (TD.IsEtwEventEnabled(5))
235 TD.WriteEtwEvent(5, eventTraceActivity, discoveryMessageName, messageId, relatesTo, discoveryOperationName, payload.AppDomainFriendlyName);
237 if (FxTrace.ShouldTraceWarningToTraceSource)
239 string description = string.Format(Culture, ResourceManager.GetString("DiscoveryMessageWithInvalidRelatesToOrOperationCompleted", Culture), discoveryMessageName, messageId, relatesTo, discoveryOperationName);
240 TD.WriteTraceSource(5, description, payload);
245 /// Check if trace definition is enabled
246 /// Event description ID=4807, Level=Warning, Channel=debug
248 internal static bool DiscoveryMessageWithInvalidReplyToIsEnabled()
250 return (FxTrace.ShouldTraceWarning
251 && (FxTrace.ShouldTraceWarningToTraceSource || TD.IsEtwEventEnabled(6)));
255 /// Gets trace definition like: A discovery request message with messageId='{0}' was dropped because it had an invalid ReplyTo address.
256 /// Event description ID=4807, Level=Warning, Channel=debug
258 /// <param name="eventTraceActivity">The event trace activity</param>
259 /// <param name="messageId">Parameter 0 for event: A discovery request message with messageId='{0}' was dropped because it had an invalid ReplyTo address.</param>
260 internal static void DiscoveryMessageWithInvalidReplyTo(System.Runtime.Diagnostics.EventTraceActivity eventTraceActivity, string messageId)
262 TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
263 if (TD.IsEtwEventEnabled(6))
265 TD.WriteEtwEvent(6, eventTraceActivity, messageId, payload.AppDomainFriendlyName);
267 if (FxTrace.ShouldTraceWarningToTraceSource)
269 string description = string.Format(Culture, ResourceManager.GetString("DiscoveryMessageWithInvalidReplyTo", Culture), messageId);
270 TD.WriteTraceSource(6, description, payload);
275 /// Check if trace definition is enabled
276 /// Event description ID=4808, Level=Warning, Channel=debug
278 internal static bool DiscoveryMessageWithNoContentIsEnabled()
280 return (FxTrace.ShouldTraceWarning
281 && (FxTrace.ShouldTraceWarningToTraceSource || TD.IsEtwEventEnabled(7)));
285 /// Gets trace definition like: A {0} message was dropped because it did not have any content.
286 /// Event description ID=4808, Level=Warning, Channel=debug
288 /// <param name="eventTraceActivity">The event trace activity</param>
289 /// <param name="messageType">Parameter 0 for event: A {0} message was dropped because it did not have any content.</param>
290 internal static void DiscoveryMessageWithNoContent(System.Runtime.Diagnostics.EventTraceActivity eventTraceActivity, string messageType)
292 TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
293 if (TD.IsEtwEventEnabled(7))
295 TD.WriteEtwEvent(7, eventTraceActivity, messageType, payload.AppDomainFriendlyName);
297 if (FxTrace.ShouldTraceWarningToTraceSource)
299 string description = string.Format(Culture, ResourceManager.GetString("DiscoveryMessageWithNoContent", Culture), messageType);
300 TD.WriteTraceSource(7, description, payload);
305 /// Check if trace definition is enabled
306 /// Event description ID=4809, Level=Warning, Channel=debug
308 internal static bool DiscoveryMessageWithNullMessageIdIsEnabled()
310 return (FxTrace.ShouldTraceWarning
311 && (FxTrace.ShouldTraceWarningToTraceSource || TD.IsEtwEventEnabled(8)));
315 /// Gets trace definition like: A {0} message was dropped because the message header did not contain the required MessageId property.
316 /// Event description ID=4809, Level=Warning, Channel=debug
318 /// <param name="eventTraceActivity">The event trace activity</param>
319 /// <param name="messageType">Parameter 0 for event: A {0} message was dropped because the message header did not contain the required MessageId property.</param>
320 internal static void DiscoveryMessageWithNullMessageId(System.Runtime.Diagnostics.EventTraceActivity eventTraceActivity, string messageType)
322 TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
323 if (TD.IsEtwEventEnabled(8))
325 TD.WriteEtwEvent(8, eventTraceActivity, messageType, payload.AppDomainFriendlyName);
327 if (FxTrace.ShouldTraceWarningToTraceSource)
329 string description = string.Format(Culture, ResourceManager.GetString("DiscoveryMessageWithNullMessageId", Culture), messageType);
330 TD.WriteTraceSource(8, description, payload);
335 /// Check if trace definition is enabled
336 /// Event description ID=4810, Level=Warning, Channel=debug
338 internal static bool DiscoveryMessageWithNullMessageSequenceIsEnabled()
340 return (FxTrace.ShouldTraceWarning
341 && (FxTrace.ShouldTraceWarningToTraceSource || TD.IsEtwEventEnabled(9)));
345 /// Gets trace definition like: A {0} message with messageId='{1}' was dropped by the DiscoveryClient because it did not have the DiscoveryMessageSequence property.
346 /// Event description ID=4810, Level=Warning, Channel=debug
348 /// <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>
349 /// <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>
350 internal static void DiscoveryMessageWithNullMessageSequence(string discoveryMessageName, string messageId)
352 TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
353 if (TD.IsEtwEventEnabled(9))
355 TD.WriteEtwEvent(9, null, discoveryMessageName, messageId, payload.AppDomainFriendlyName);
357 if (FxTrace.ShouldTraceWarningToTraceSource)
359 string description = string.Format(Culture, ResourceManager.GetString("DiscoveryMessageWithNullMessageSequence", Culture), discoveryMessageName, messageId);
360 TD.WriteTraceSource(9, description, payload);
365 /// Check if trace definition is enabled
366 /// Event description ID=4811, Level=Warning, Channel=debug
368 internal static bool DiscoveryMessageWithNullRelatesToIsEnabled()
370 return (FxTrace.ShouldTraceWarning
371 && (FxTrace.ShouldTraceWarningToTraceSource || TD.IsEtwEventEnabled(10)));
375 /// 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.
376 /// Event description ID=4811, Level=Warning, Channel=debug
378 /// <param name="eventTraceActivity">The event trace activity</param>
379 /// <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>
380 /// <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>
381 internal static void DiscoveryMessageWithNullRelatesTo(System.Runtime.Diagnostics.EventTraceActivity eventTraceActivity, string discoveryMessageName, string messageId)
383 TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
384 if (TD.IsEtwEventEnabled(10))
386 TD.WriteEtwEvent(10, eventTraceActivity, discoveryMessageName, messageId, payload.AppDomainFriendlyName);
388 if (FxTrace.ShouldTraceWarningToTraceSource)
390 string description = string.Format(Culture, ResourceManager.GetString("DiscoveryMessageWithNullRelatesTo", Culture), discoveryMessageName, messageId);
391 TD.WriteTraceSource(10, description, payload);
396 /// Check if trace definition is enabled
397 /// Event description ID=4812, Level=Warning, Channel=debug
399 internal static bool DiscoveryMessageWithNullReplyToIsEnabled()
401 return (FxTrace.ShouldTraceWarning
402 && (FxTrace.ShouldTraceWarningToTraceSource || TD.IsEtwEventEnabled(11)));
406 /// Gets trace definition like: A discovery request message with messageId='{0}' was dropped because it did not have a ReplyTo address.
407 /// Event description ID=4812, Level=Warning, Channel=debug
409 /// <param name="eventTraceActivity">The event trace activity</param>
410 /// <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>
411 internal static void DiscoveryMessageWithNullReplyTo(System.Runtime.Diagnostics.EventTraceActivity eventTraceActivity, string messageId)
413 TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
414 if (TD.IsEtwEventEnabled(11))
416 TD.WriteEtwEvent(11, eventTraceActivity, messageId, payload.AppDomainFriendlyName);
418 if (FxTrace.ShouldTraceWarningToTraceSource)
420 string description = string.Format(Culture, ResourceManager.GetString("DiscoveryMessageWithNullReplyTo", Culture), messageId);
421 TD.WriteTraceSource(11, description, payload);
426 /// Check if trace definition is enabled
427 /// Event description ID=4813, Level=Warning, Channel=debug
429 internal static bool DuplicateDiscoveryMessageIsEnabled()
431 return (FxTrace.ShouldTraceWarning
432 && (FxTrace.ShouldTraceWarningToTraceSource || TD.IsEtwEventEnabled(12)));
436 /// Gets trace definition like: A {0} message with messageId='{1}' was dropped because it was a duplicate.
437 /// Event description ID=4813, Level=Warning, Channel=debug
439 /// <param name="eventTraceActivity">The event trace activity</param>
440 /// <param name="messageType">Parameter 0 for event: A {0} message with messageId='{1}' was dropped because it was a duplicate.</param>
441 /// <param name="messageId">Parameter 1 for event: A {0} message with messageId='{1}' was dropped because it was a duplicate.</param>
442 internal static void DuplicateDiscoveryMessage(System.Runtime.Diagnostics.EventTraceActivity eventTraceActivity, string messageType, string messageId)
444 TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
445 if (TD.IsEtwEventEnabled(12))
447 TD.WriteEtwEvent(12, eventTraceActivity, messageType, messageId, payload.AppDomainFriendlyName);
449 if (FxTrace.ShouldTraceWarningToTraceSource)
451 string description = string.Format(Culture, ResourceManager.GetString("DuplicateDiscoveryMessage", Culture), messageType, messageId);
452 TD.WriteTraceSource(12, description, payload);
457 /// Check if trace definition is enabled
458 /// Event description ID=4814, Level=Informational, Channel=debug
460 internal static bool EndpointDiscoverabilityDisabledIsEnabled()
462 return (FxTrace.ShouldTraceInformation
463 && (FxTrace.ShouldTraceInformationToTraceSource || TD.IsEtwEventEnabled(13)));
467 /// Gets trace definition like: The discoverability of endpoint with EndpointAddress='{0}' and ListenUri='{1}' has been disabled.
468 /// Event description ID=4814, Level=Informational, Channel=debug
470 /// <param name="endpointAddress">Parameter 0 for event: The discoverability of endpoint with EndpointAddress='{0}' and ListenUri='{1}' has been disabled.</param>
471 /// <param name="listenUri">Parameter 1 for event: The discoverability of endpoint with EndpointAddress='{0}' and ListenUri='{1}' has been disabled.</param>
472 internal static void EndpointDiscoverabilityDisabled(string endpointAddress, string listenUri)
474 TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
475 if (TD.IsEtwEventEnabled(13))
477 TD.WriteEtwEvent(13, null, endpointAddress, listenUri, payload.AppDomainFriendlyName);
479 if (FxTrace.ShouldTraceInformationToTraceSource)
481 string description = string.Format(Culture, ResourceManager.GetString("EndpointDiscoverabilityDisabled", Culture), endpointAddress, listenUri);
482 TD.WriteTraceSource(13, description, payload);
487 /// Check if trace definition is enabled
488 /// Event description ID=4815, Level=Informational, Channel=debug
490 internal static bool EndpointDiscoverabilityEnabledIsEnabled()
492 return (FxTrace.ShouldTraceInformation
493 && (FxTrace.ShouldTraceInformationToTraceSource || TD.IsEtwEventEnabled(14)));
497 /// Gets trace definition like: The discoverability of endpoint with EndpointAddress='{0}' and ListenUri='{1}' has been enabled.
498 /// Event description ID=4815, Level=Informational, Channel=debug
500 /// <param name="endpointAddress">Parameter 0 for event: The discoverability of endpoint with EndpointAddress='{0}' and ListenUri='{1}' has been enabled.</param>
501 /// <param name="listenUri">Parameter 1 for event: The discoverability of endpoint with EndpointAddress='{0}' and ListenUri='{1}' has been enabled.</param>
502 internal static void EndpointDiscoverabilityEnabled(string endpointAddress, string listenUri)
504 TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
505 if (TD.IsEtwEventEnabled(14))
507 TD.WriteEtwEvent(14, null, endpointAddress, listenUri, payload.AppDomainFriendlyName);
509 if (FxTrace.ShouldTraceInformationToTraceSource)
511 string description = string.Format(Culture, ResourceManager.GetString("EndpointDiscoverabilityEnabled", Culture), endpointAddress, listenUri);
512 TD.WriteTraceSource(14, description, payload);
517 /// Check if trace definition is enabled
518 /// Event description ID=4816, Level=Verbose, Channel=debug
520 internal static bool FindInitiatedInDiscoveryClientChannelIsEnabled()
522 return (FxTrace.ShouldTraceVerbose
523 && (FxTrace.ShouldTraceVerboseToTraceSource || TD.IsEtwEventEnabled(15)));
527 /// Gets trace definition like: A Find operation was initiated in the DiscoveryClientChannel to discover endpoint(s).
528 /// Event description ID=4816, Level=Verbose, Channel=debug
530 internal static void FindInitiatedInDiscoveryClientChannel()
532 TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
533 if (TD.IsEtwEventEnabled(15))
535 TD.WriteEtwEvent(15, null, payload.AppDomainFriendlyName);
537 if (FxTrace.ShouldTraceVerboseToTraceSource)
539 string description = string.Format(Culture, ResourceManager.GetString("FindInitiatedInDiscoveryClientChannel", Culture));
540 TD.WriteTraceSource(15, description, payload);
545 /// Check if trace definition is enabled
546 /// Event description ID=4817, Level=Warning, Channel=debug
548 internal static bool InnerChannelCreationFailedIsEnabled()
550 return (FxTrace.ShouldTraceWarning
551 && (FxTrace.ShouldTraceWarningToTraceSource || TD.IsEtwEventEnabled(16)));
555 /// 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.
556 /// Event description ID=4817, Level=Warning, Channel=debug
558 /// <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>
559 /// <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>
560 /// <param name="exception">Exception associated with the event</param>
561 internal static void InnerChannelCreationFailed(string endpointAddress, string via, System.Exception exception)
563 TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, exception);
564 if (TD.IsEtwEventEnabled(16))
566 TD.WriteEtwEvent(16, null, endpointAddress, via, payload.SerializedException, payload.AppDomainFriendlyName);
568 if (FxTrace.ShouldTraceWarningToTraceSource)
570 string description = string.Format(Culture, ResourceManager.GetString("InnerChannelCreationFailed", Culture), endpointAddress, via);
571 TD.WriteTraceSource(16, description, payload);
576 /// Check if trace definition is enabled
577 /// Event description ID=4818, Level=Warning, Channel=debug
579 internal static bool InnerChannelOpenFailedIsEnabled()
581 return (FxTrace.ShouldTraceWarning
582 && (FxTrace.ShouldTraceWarningToTraceSource || TD.IsEtwEventEnabled(17)));
586 /// 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.
587 /// Event description ID=4818, Level=Warning, Channel=debug
589 /// <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>
590 /// <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>
591 /// <param name="exception">Exception associated with the event</param>
592 internal static void InnerChannelOpenFailed(string endpointAddress, string via, System.Exception exception)
594 TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, exception);
595 if (TD.IsEtwEventEnabled(17))
597 TD.WriteEtwEvent(17, null, endpointAddress, via, payload.SerializedException, payload.AppDomainFriendlyName);
599 if (FxTrace.ShouldTraceWarningToTraceSource)
601 string description = string.Format(Culture, ResourceManager.GetString("InnerChannelOpenFailed", Culture), endpointAddress, via);
602 TD.WriteTraceSource(17, description, payload);
607 /// Check if trace definition is enabled
608 /// Event description ID=4819, Level=Informational, Channel=debug
610 internal static bool InnerChannelOpenSucceededIsEnabled()
612 return (FxTrace.ShouldTraceInformation
613 && (FxTrace.ShouldTraceInformationToTraceSource || TD.IsEtwEventEnabled(18)));
617 /// 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}'.
618 /// Event description ID=4819, Level=Informational, Channel=debug
620 /// <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>
621 /// <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>
622 internal static void InnerChannelOpenSucceeded(string endpointAddress, string via)
624 TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
625 if (TD.IsEtwEventEnabled(18))
627 TD.WriteEtwEvent(18, null, endpointAddress, via, payload.AppDomainFriendlyName);
629 if (FxTrace.ShouldTraceInformationToTraceSource)
631 string description = string.Format(Culture, ResourceManager.GetString("InnerChannelOpenSucceeded", Culture), endpointAddress, via);
632 TD.WriteTraceSource(18, description, payload);
637 /// Check if trace definition is enabled
638 /// Event description ID=4820, Level=Informational, Channel=debug
640 internal static bool SynchronizationContextResetIsEnabled()
642 return (FxTrace.ShouldTraceInformation
643 && (FxTrace.ShouldTraceInformationToTraceSource || TD.IsEtwEventEnabled(19)));
647 /// Gets trace definition like: The SynchronizationContext has been reset to its original value of {0} by DiscoveryClientChannel.
648 /// Event description ID=4820, Level=Informational, Channel=debug
650 /// <param name="synchronizationContextType">Parameter 0 for event: The SynchronizationContext has been reset to its original value of {0} by DiscoveryClientChannel.</param>
651 internal static void SynchronizationContextReset(string synchronizationContextType)
653 TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
654 if (TD.IsEtwEventEnabled(19))
656 TD.WriteEtwEvent(19, null, synchronizationContextType, payload.AppDomainFriendlyName);
658 if (FxTrace.ShouldTraceInformationToTraceSource)
660 string description = string.Format(Culture, ResourceManager.GetString("SynchronizationContextReset", Culture), synchronizationContextType);
661 TD.WriteTraceSource(19, description, payload);
666 /// Check if trace definition is enabled
667 /// Event description ID=4821, Level=Informational, Channel=debug
669 internal static bool SynchronizationContextSetToNullIsEnabled()
671 return (FxTrace.ShouldTraceInformation
672 && (FxTrace.ShouldTraceInformationToTraceSource || TD.IsEtwEventEnabled(20)));
676 /// Gets trace definition like: The SynchronizationContext has been set to null by DiscoveryClientChannel before initiating the Find operation.
677 /// Event description ID=4821, Level=Informational, Channel=debug
679 internal static void SynchronizationContextSetToNull()
681 TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
682 if (TD.IsEtwEventEnabled(20))
684 TD.WriteEtwEvent(20, null, payload.AppDomainFriendlyName);
686 if (FxTrace.ShouldTraceInformationToTraceSource)
688 string description = string.Format(Culture, ResourceManager.GetString("SynchronizationContextSetToNull", Culture));
689 TD.WriteTraceSource(20, description, payload);
694 /// Creates the event descriptors array
696 static void CreateEventDescriptors()
698 System.Runtime.Diagnostics.EventDescriptor[] descriptors = new System.Runtime.Diagnostics.EventDescriptor[] {
699 new System.Runtime.Diagnostics.EventDescriptor(4801, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Warning, (byte)30, 0x9e1, 0x1000000000004000),
700 new System.Runtime.Diagnostics.EventDescriptor(4802, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Informational, (byte)29, 0x9e1, 0x1000000000004000),
701 new System.Runtime.Diagnostics.EventDescriptor(4803, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Informational, (byte)31, 0x9e1, 0x1000000000004000),
702 new System.Runtime.Diagnostics.EventDescriptor(4804, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Informational, (byte)45, 0x9e3, 0x1000000000004000),
703 new System.Runtime.Diagnostics.EventDescriptor(4805, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Warning, (byte)37, 0x9e3, 0x1000000000004000),
704 new System.Runtime.Diagnostics.EventDescriptor(4806, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Warning, (byte)38, 0x9e3, 0x1000000000004000),
705 new System.Runtime.Diagnostics.EventDescriptor(4807, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Warning, (byte)39, 0x9e3, 0x1000000000004000),
706 new System.Runtime.Diagnostics.EventDescriptor(4808, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Warning, (byte)40, 0x9e3, 0x1000000000004000),
707 new System.Runtime.Diagnostics.EventDescriptor(4809, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Warning, (byte)41, 0x9e3, 0x1000000000004000),
708 new System.Runtime.Diagnostics.EventDescriptor(4810, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Warning, (byte)42, 0x9e3, 0x1000000000004000),
709 new System.Runtime.Diagnostics.EventDescriptor(4811, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Warning, (byte)43, 0x9e3, 0x1000000000004000),
710 new System.Runtime.Diagnostics.EventDescriptor(4812, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Warning, (byte)44, 0x9e3, 0x1000000000004000),
711 new System.Runtime.Diagnostics.EventDescriptor(4813, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Warning, (byte)36, 0x9e3, 0x1000000000004000),
712 new System.Runtime.Diagnostics.EventDescriptor(4814, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Informational, (byte)58, 0x9e6, 0x1000000000004000),
713 new System.Runtime.Diagnostics.EventDescriptor(4815, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Informational, (byte)59, 0x9e6, 0x1000000000004000),
714 new System.Runtime.Diagnostics.EventDescriptor(4816, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Verbose, (byte)33, 0x9e2, 0x1000000000004000),
715 new System.Runtime.Diagnostics.EventDescriptor(4817, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Warning, (byte)32, 0x9e2, 0x1000000000004000),
716 new System.Runtime.Diagnostics.EventDescriptor(4818, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Warning, (byte)34, 0x9e2, 0x1000000000004000),
717 new System.Runtime.Diagnostics.EventDescriptor(4819, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Informational, (byte)35, 0x9e2, 0x1000000000004000),
718 new System.Runtime.Diagnostics.EventDescriptor(4820, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Informational, (byte)46, 0x9e4, 0x1000000000004000),
719 new System.Runtime.Diagnostics.EventDescriptor(4821, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Informational, (byte)47, 0x9e4, 0x1000000000004000)};
720 ushort[] e2eEvents = new ushort[] {
730 FxTrace.UpdateEventDefinitions(descriptors, e2eEvents);
731 eventDescriptors = descriptors;
735 /// Ensures that the event descriptors array is initialized
737 static void EnsureEventDescriptors()
739 if (eventDescriptorsCreated)
743 System.Threading.Monitor.Enter(syncLock);
746 if (eventDescriptorsCreated)
750 CreateEventDescriptors();
751 eventDescriptorsCreated = true;
755 System.Threading.Monitor.Exit(syncLock);
760 /// Check if ETW tracing is enabled for the particular event
762 /// <param name="eventIndex">The index of the event descriptor</param>
763 static bool IsEtwEventEnabled(int eventIndex)
765 if (FxTrace.Trace.IsEtwProviderEnabled)
767 EnsureEventDescriptors();
768 return FxTrace.IsEventEnabled(eventIndex);
774 /// Writes ETW trace event
776 /// <param name="eventIndex">The index of the event descriptor</param>>
777 /// <param name="eventParam0">A parameter of the ETW event</param>>
778 /// <param name="eventParam1">A parameter of the ETW event</param>>
779 /// <param name="eventParam2">A parameter of the ETW event</param>>
780 static bool WriteEtwEvent(int eventIndex, System.Runtime.Diagnostics.EventTraceActivity eventParam0, string eventParam1, string eventParam2)
782 EnsureEventDescriptors();
783 return FxTrace.Trace.EtwProvider.WriteEvent(ref eventDescriptors[eventIndex], eventParam0, eventParam1, eventParam2);
787 /// Writes ETW trace event
789 /// <param name="eventIndex">The index of the event descriptor</param>>
790 /// <param name="eventParam0">A parameter of the ETW event</param>>
791 /// <param name="eventParam1">A parameter of the ETW event</param>>
792 static bool WriteEtwEvent(int eventIndex, System.Runtime.Diagnostics.EventTraceActivity eventParam0, string eventParam1)
794 EnsureEventDescriptors();
795 return FxTrace.Trace.EtwProvider.WriteEvent(ref eventDescriptors[eventIndex], eventParam0, eventParam1);
799 /// Writes ETW trace event
801 /// <param name="eventIndex">The index of the event descriptor</param>>
802 /// <param name="eventParam0">A parameter of the ETW event</param>>
803 /// <param name="eventParam1">A parameter of the ETW event</param>>
804 /// <param name="eventParam2">A parameter of the ETW event</param>>
805 /// <param name="eventParam3">A parameter of the ETW event</param>>
806 /// <param name="eventParam4">A parameter of the ETW event</param>>
807 static bool WriteEtwEvent(int eventIndex, System.Runtime.Diagnostics.EventTraceActivity eventParam0, string eventParam1, string eventParam2, string eventParam3, string eventParam4)
809 EnsureEventDescriptors();
810 return FxTrace.Trace.EtwProvider.WriteEvent(ref eventDescriptors[eventIndex], eventParam0, eventParam1, eventParam2, eventParam3, eventParam4);
814 /// Writes ETW trace event
816 /// <param name="eventIndex">The index of the event descriptor</param>>
817 /// <param name="eventParam0">A parameter of the ETW event</param>>
818 /// <param name="eventParam1">A parameter of the ETW event</param>>
819 /// <param name="eventParam2">A parameter of the ETW event</param>>
820 /// <param name="eventParam3">A parameter of the ETW event</param>>
821 static bool WriteEtwEvent(int eventIndex, System.Runtime.Diagnostics.EventTraceActivity eventParam0, string eventParam1, string eventParam2, string eventParam3)
823 EnsureEventDescriptors();
824 return FxTrace.Trace.EtwProvider.WriteEvent(ref eventDescriptors[eventIndex], eventParam0, eventParam1, eventParam2, eventParam3);
828 /// Writes ETW trace event
830 /// <param name="eventIndex">The index of the event descriptor</param>>
831 /// <param name="eventParam0">A parameter of the ETW event</param>>
832 /// <param name="eventParam1">A parameter of the ETW event</param>>
833 /// <param name="eventParam2">A parameter of the ETW event</param>>
834 /// <param name="eventParam3">A parameter of the ETW event</param>>
835 /// <param name="eventParam4">A parameter of the ETW event</param>>
836 /// <param name="eventParam5">A parameter of the ETW event</param>>
837 static bool WriteEtwEvent(int eventIndex, System.Runtime.Diagnostics.EventTraceActivity eventParam0, string eventParam1, string eventParam2, string eventParam3, string eventParam4, string eventParam5)
839 EnsureEventDescriptors();
840 return FxTrace.Trace.EtwProvider.WriteEvent(ref eventDescriptors[eventIndex], eventParam0, eventParam1, eventParam2, eventParam3, eventParam4, eventParam5);
844 /// write a trace source into the diagnostic trace
846 /// <param name="eventIndex">The index of the event descriptor</param>
847 /// <param name="description">The description to write</param>
848 /// <param name="payload">The trace payload</param>
849 static void WriteTraceSource(int eventIndex, string description, TracePayload payload)
851 EnsureEventDescriptors();
852 FxTrace.Trace.WriteTraceSource(ref eventDescriptors[eventIndex], description, payload);