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.Activities
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.Activities.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=57398, Level=Warning, Channel=Analytic
66 internal static bool MaxInstancesExceededIsEnabled()
68 return (FxTrace.ShouldTraceWarning
69 && (FxTrace.ShouldTraceWarningToTraceSource || TD.IsEtwEventEnabled(0)));
73 /// Gets trace definition like: The system hit the limit set for throttle 'MaxConcurrentInstances'. Limit for this throttle was set to {0}. Throttle value can be changed by modifying attribute 'maxConcurrentInstances' in serviceThrottle element or by modifying 'MaxConcurrentInstances' property on behavior ServiceThrottlingBehavior.
74 /// Event description ID=57398, Level=Warning, Channel=Analytic
76 /// <param name="limit">Parameter 0 for event: The system hit the limit set for throttle 'MaxConcurrentInstances'. Limit for this throttle was set to {0}. Throttle value can be changed by modifying attribute 'maxConcurrentInstances' in serviceThrottle element or by modifying 'MaxConcurrentInstances' property on behavior ServiceThrottlingBehavior.</param>
77 internal static void MaxInstancesExceeded(int limit)
79 TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
80 if (TD.IsEtwEventEnabled(0))
82 TD.WriteEtwEvent(0, null, limit, payload.AppDomainFriendlyName);
84 if (FxTrace.ShouldTraceWarningToTraceSource)
86 string description = string.Format(Culture, ResourceManager.GetString("MaxInstancesExceeded", Culture), limit);
87 TD.WriteTraceSource(0, description, payload);
92 /// Check if trace definition is enabled
93 /// Event description ID=3501, Level=Informational, Channel=Analytic
95 internal static bool InferredContractDescriptionIsEnabled()
97 return (FxTrace.ShouldTraceInformation
98 && (FxTrace.ShouldTraceInformationToTraceSource || TD.IsEtwEventEnabled(1)));
102 /// Gets trace definition like: ContractDescription with Name='{0}' and Namespace='{1}' has been inferred from WorkflowService.
103 /// Event description ID=3501, Level=Informational, Channel=Analytic
105 /// <param name="param0">Parameter 0 for event: ContractDescription with Name='{0}' and Namespace='{1}' has been inferred from WorkflowService.</param>
106 /// <param name="param1">Parameter 1 for event: ContractDescription with Name='{0}' and Namespace='{1}' has been inferred from WorkflowService.</param>
107 internal static void InferredContractDescription(string param0, string param1)
109 TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
110 if (TD.IsEtwEventEnabled(1))
112 TD.WriteEtwEvent(1, null, param0, param1, payload.AppDomainFriendlyName);
114 if (FxTrace.ShouldTraceInformationToTraceSource)
116 string description = string.Format(Culture, ResourceManager.GetString("InferredContractDescription", Culture), param0, param1);
117 TD.WriteTraceSource(1, description, payload);
122 /// Check if trace definition is enabled
123 /// Event description ID=3502, Level=Informational, Channel=Analytic
125 internal static bool InferredOperationDescriptionIsEnabled()
127 return (FxTrace.ShouldTraceInformation
128 && (FxTrace.ShouldTraceInformationToTraceSource || TD.IsEtwEventEnabled(2)));
132 /// Gets trace definition like: OperationDescription with Name='{0}' in contract '{1}' has been inferred from WorkflowService. IsOneWay={2}.
133 /// Event description ID=3502, Level=Informational, Channel=Analytic
135 /// <param name="param0">Parameter 0 for event: OperationDescription with Name='{0}' in contract '{1}' has been inferred from WorkflowService. IsOneWay={2}.</param>
136 /// <param name="param1">Parameter 1 for event: OperationDescription with Name='{0}' in contract '{1}' has been inferred from WorkflowService. IsOneWay={2}.</param>
137 /// <param name="param2">Parameter 2 for event: OperationDescription with Name='{0}' in contract '{1}' has been inferred from WorkflowService. IsOneWay={2}.</param>
138 internal static void InferredOperationDescription(string param0, string param1, string param2)
140 TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
141 if (TD.IsEtwEventEnabled(2))
143 TD.WriteEtwEvent(2, null, param0, param1, param2, payload.AppDomainFriendlyName);
145 if (FxTrace.ShouldTraceInformationToTraceSource)
147 string description = string.Format(Culture, ResourceManager.GetString("InferredOperationDescription", Culture), param0, param1, param2);
148 TD.WriteTraceSource(2, description, payload);
153 /// Check if trace definition is enabled
154 /// Event description ID=3503, Level=Warning, Channel=Analytic
156 internal static bool DuplicateCorrelationQueryIsEnabled()
158 return (FxTrace.ShouldTraceWarning
159 && (FxTrace.ShouldTraceWarningToTraceSource || TD.IsEtwEventEnabled(3)));
163 /// Gets trace definition like: A duplicate CorrelationQuery was found with Where='{0}'. This duplicate query will not be used when calculating correlation.
164 /// Event description ID=3503, Level=Warning, Channel=Analytic
166 /// <param name="param0">Parameter 0 for event: A duplicate CorrelationQuery was found with Where='{0}'. This duplicate query will not be used when calculating correlation.</param>
167 internal static void DuplicateCorrelationQuery(string param0)
169 TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
170 if (TD.IsEtwEventEnabled(3))
172 TD.WriteEtwEvent(3, null, param0, payload.AppDomainFriendlyName);
174 if (FxTrace.ShouldTraceWarningToTraceSource)
176 string description = string.Format(Culture, ResourceManager.GetString("DuplicateCorrelationQuery", Culture), param0);
177 TD.WriteTraceSource(3, description, payload);
182 /// Check if trace definition is enabled
183 /// Event description ID=3507, Level=Informational, Channel=Analytic
185 internal static bool ServiceEndpointAddedIsEnabled()
187 return (FxTrace.ShouldTraceInformation
188 && (FxTrace.ShouldTraceInformationToTraceSource || TD.IsEtwEventEnabled(4)));
192 /// Gets trace definition like: A service endpoint has been added for address '{0}', binding '{1}', and contract '{2}'.
193 /// Event description ID=3507, Level=Informational, Channel=Analytic
195 /// <param name="param0">Parameter 0 for event: A service endpoint has been added for address '{0}', binding '{1}', and contract '{2}'.</param>
196 /// <param name="param1">Parameter 1 for event: A service endpoint has been added for address '{0}', binding '{1}', and contract '{2}'.</param>
197 /// <param name="param2">Parameter 2 for event: A service endpoint has been added for address '{0}', binding '{1}', and contract '{2}'.</param>
198 internal static void ServiceEndpointAdded(string param0, string param1, string param2)
200 TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
201 if (TD.IsEtwEventEnabled(4))
203 TD.WriteEtwEvent(4, null, param0, param1, param2, payload.AppDomainFriendlyName);
205 if (FxTrace.ShouldTraceInformationToTraceSource)
207 string description = string.Format(Culture, ResourceManager.GetString("ServiceEndpointAdded", Culture), param0, param1, param2);
208 TD.WriteTraceSource(4, description, payload);
213 /// Check if trace definition is enabled
214 /// Event description ID=440, Level=informational, Channel=Analytic
216 internal static bool StartSignpostEventIsEnabled()
218 return (FxTrace.ShouldTraceInformation
219 && (FxTrace.ShouldTraceInformationToTraceSource || TD.IsEtwEventEnabled(5)));
223 /// Gets trace definition like: Activity boundary.
224 /// Event description ID=440, Level=informational, Channel=Analytic
226 /// <param name="traceRecord">Extended data (TraceRecord) for the event</param>
227 internal static void StartSignpostEvent(TraceRecord traceRecord)
229 TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, traceRecord, null);
230 if (TD.IsEtwEventEnabled(5))
232 TD.WriteEtwEvent(5, null, payload.ExtendedData, payload.AppDomainFriendlyName);
234 if (FxTrace.ShouldTraceInformationToTraceSource)
236 string description = string.Format(Culture, ResourceManager.GetString("StartSignpostEvent", Culture));
237 TD.WriteTraceSource(5, description, payload);
242 /// Check if trace definition is enabled
243 /// Event description ID=441, Level=informational, Channel=Analytic
245 internal static bool StopSignpostEventIsEnabled()
247 return (FxTrace.ShouldTraceInformation
248 && (FxTrace.ShouldTraceInformationToTraceSource || TD.IsEtwEventEnabled(6)));
252 /// Gets trace definition like: Activity boundary.
253 /// Event description ID=441, Level=informational, Channel=Analytic
255 /// <param name="traceRecord">Extended data (TraceRecord) for the event</param>
256 internal static void StopSignpostEvent(TraceRecord traceRecord)
258 TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, traceRecord, null);
259 if (TD.IsEtwEventEnabled(6))
261 TD.WriteEtwEvent(6, null, payload.ExtendedData, payload.AppDomainFriendlyName);
263 if (FxTrace.ShouldTraceInformationToTraceSource)
265 string description = string.Format(Culture, ResourceManager.GetString("StopSignpostEvent", Culture));
266 TD.WriteTraceSource(6, description, payload);
271 /// Check if trace definition is enabled
272 /// Event description ID=3550, Level=Informational, Channel=Analytic
274 internal static bool BufferOutOfOrderMessageNoInstanceIsEnabled()
276 return (FxTrace.ShouldTraceInformation
277 && (FxTrace.ShouldTraceInformationToTraceSource || TD.IsEtwEventEnabled(7)));
281 /// Gets trace definition like: Operation '{0}' cannot be performed at this time. Another attempt will be made when the service instance is ready to process this particular operation.
282 /// Event description ID=3550, Level=Informational, Channel=Analytic
284 /// <param name="param0">Parameter 0 for event: Operation '{0}' cannot be performed at this time. Another attempt will be made when the service instance is ready to process this particular operation.</param>
285 internal static void BufferOutOfOrderMessageNoInstance(string param0)
287 TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
288 if (TD.IsEtwEventEnabled(7))
290 TD.WriteEtwEvent(7, null, param0, payload.AppDomainFriendlyName);
292 if (FxTrace.ShouldTraceInformationToTraceSource)
294 string description = string.Format(Culture, ResourceManager.GetString("BufferOutOfOrderMessageNoInstance", Culture), param0);
295 TD.WriteTraceSource(7, description, payload);
300 /// Check if trace definition is enabled
301 /// Event description ID=3551, Level=Informational, Channel=Analytic
303 internal static bool BufferOutOfOrderMessageNoBookmarkIsEnabled()
305 return (FxTrace.ShouldTraceInformation
306 && (FxTrace.ShouldTraceInformationToTraceSource || TD.IsEtwEventEnabled(8)));
310 /// Gets trace definition like: Operation '{1}' on service instance '{0}' cannot be performed at this time. Another attempt will be made when the service instance is ready to process this particular operation.
311 /// Event description ID=3551, Level=Informational, Channel=Analytic
313 /// <param name="eventTraceActivity">The event trace activity</param>
314 /// <param name="param0">Parameter 0 for event: Operation '{1}' on service instance '{0}' cannot be performed at this time. Another attempt will be made when the service instance is ready to process this particular operation.</param>
315 /// <param name="param1">Parameter 1 for event: Operation '{1}' on service instance '{0}' cannot be performed at this time. Another attempt will be made when the service instance is ready to process this particular operation.</param>
316 internal static void BufferOutOfOrderMessageNoBookmark(System.Runtime.Diagnostics.EventTraceActivity eventTraceActivity, string param0, string param1)
318 TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
319 if (TD.IsEtwEventEnabled(8))
321 TD.WriteEtwEvent(8, eventTraceActivity, param0, param1, payload.AppDomainFriendlyName);
323 if (FxTrace.ShouldTraceInformationToTraceSource)
325 string description = string.Format(Culture, ResourceManager.GetString("BufferOutOfOrderMessageNoBookmark", Culture), param0, param1);
326 TD.WriteTraceSource(8, description, payload);
331 /// Check if trace definition is enabled
332 /// Event description ID=3552, Level=Warning, Channel=Analytic
334 internal static bool MaxPendingMessagesPerChannelExceededIsEnabled()
336 return (FxTrace.ShouldTraceWarning
337 && (FxTrace.ShouldTraceWarningToTraceSource || TD.IsEtwEventEnabled(9)));
341 /// Gets trace definition like: The throttle 'MaxPendingMessagesPerChannel' limit of '{0}' was hit. To increase this limit, adjust the MaxPendingMessagesPerChannel property on BufferedReceiveServiceBehavior.
342 /// Event description ID=3552, Level=Warning, Channel=Analytic
344 /// <param name="limit">Parameter 0 for event: The throttle 'MaxPendingMessagesPerChannel' limit of '{0}' was hit. To increase this limit, adjust the MaxPendingMessagesPerChannel property on BufferedReceiveServiceBehavior.</param>
345 internal static void MaxPendingMessagesPerChannelExceeded(int limit)
347 TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
348 if (TD.IsEtwEventEnabled(9))
350 TD.WriteEtwEvent(9, null, limit, payload.AppDomainFriendlyName);
352 if (FxTrace.ShouldTraceWarningToTraceSource)
354 string description = string.Format(Culture, ResourceManager.GetString("MaxPendingMessagesPerChannelExceeded", Culture), limit);
355 TD.WriteTraceSource(9, description, payload);
360 /// Check if trace definition is enabled
361 /// Event description ID=3555, Level=informational, Channel=debug
363 internal static bool CreateWorkflowServiceHostStartIsEnabled()
365 return (FxTrace.ShouldTraceInformation && TD.IsEtwEventEnabled(10));
369 /// Gets trace definition like: CreateWorkflowServiceHost start
370 /// Event description ID=3555, Level=informational, Channel=debug
372 internal static void CreateWorkflowServiceHostStart()
374 TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
375 if (TD.IsEtwEventEnabled(10))
377 TD.WriteEtwEvent(10, null, payload.AppDomainFriendlyName);
382 /// Check if trace definition is enabled
383 /// Event description ID=3556, Level=informational, Channel=debug
385 internal static bool CreateWorkflowServiceHostStopIsEnabled()
387 return (FxTrace.ShouldTraceInformation && TD.IsEtwEventEnabled(11));
391 /// Gets trace definition like: CreateWorkflowServiceHost Stop
392 /// Event description ID=3556, Level=informational, Channel=debug
394 internal static void CreateWorkflowServiceHostStop()
396 TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
397 if (TD.IsEtwEventEnabled(11))
399 TD.WriteEtwEvent(11, null, payload.AppDomainFriendlyName);
404 /// Check if trace definition is enabled
405 /// Event description ID=3557, Level=informational, Channel=Analytic
407 internal static bool TransactedReceiveScopeEndCommitFailedIsEnabled()
409 return (FxTrace.ShouldTraceInformation
410 && (FxTrace.ShouldTraceInformationToTraceSource || TD.IsEtwEventEnabled(12)));
414 /// Gets trace definition like: The call to EndCommit on the CommittableTransaction with id = '{0}' threw a TransactionException with the following message: '{1}'.
415 /// Event description ID=3557, Level=informational, Channel=Analytic
417 /// <param name="param0">Parameter 0 for event: The call to EndCommit on the CommittableTransaction with id = '{0}' threw a TransactionException with the following message: '{1}'.</param>
418 /// <param name="param1">Parameter 1 for event: The call to EndCommit on the CommittableTransaction with id = '{0}' threw a TransactionException with the following message: '{1}'.</param>
419 internal static void TransactedReceiveScopeEndCommitFailed(string param0, string param1)
421 TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
422 if (TD.IsEtwEventEnabled(12))
424 TD.WriteEtwEvent(12, null, param0, param1, payload.AppDomainFriendlyName);
426 if (FxTrace.ShouldTraceInformationToTraceSource)
428 string description = string.Format(Culture, ResourceManager.GetString("TransactedReceiveScopeEndCommitFailed", Culture), param0, param1);
429 TD.WriteTraceSource(12, description, payload);
434 /// Check if trace definition is enabled
435 /// Event description ID=3508, Level=verbose, Channel=Analytic
437 internal static bool TrackingProfileNotFoundIsEnabled()
439 return (FxTrace.ShouldTraceVerbose
440 && (FxTrace.ShouldTraceVerboseToTraceSource || TD.IsEtwEventEnabled(13)));
444 /// Gets trace definition like: TrackingProfile '{0}' for the ActivityDefinitionId '{1}' not found. Either the TrackingProfile is not found in the config file or the ActivityDefinitionId does not match.
445 /// Event description ID=3508, Level=verbose, Channel=Analytic
447 /// <param name="TrackingProfile">Parameter 0 for event: TrackingProfile '{0}' for the ActivityDefinitionId '{1}' not found. Either the TrackingProfile is not found in the config file or the ActivityDefinitionId does not match.</param>
448 /// <param name="ActivityDefinitionId">Parameter 1 for event: TrackingProfile '{0}' for the ActivityDefinitionId '{1}' not found. Either the TrackingProfile is not found in the config file or the ActivityDefinitionId does not match.</param>
449 internal static void TrackingProfileNotFound(string TrackingProfile, string ActivityDefinitionId)
451 TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
452 if (TD.IsEtwEventEnabled(13))
454 TD.WriteEtwEvent(13, null, TrackingProfile, ActivityDefinitionId, payload.AppDomainFriendlyName);
456 if (FxTrace.ShouldTraceVerboseToTraceSource)
458 string description = string.Format(Culture, ResourceManager.GetString("TrackingProfileNotFound", Culture), TrackingProfile, ActivityDefinitionId);
459 TD.WriteTraceSource(13, description, payload);
464 /// Check if trace definition is enabled
465 /// Event description ID=225, Level=informational, Channel=Analytic
467 internal static bool TraceCorrelationKeysIsEnabled()
469 return (FxTrace.ShouldTraceInformation
470 && (FxTrace.ShouldTraceInformationToTraceSource || TD.IsEtwEventEnabled(14)));
474 /// Gets trace definition like: Calculated correlation key '{0}' using values '{1}' in parent scope '{2}'.
475 /// Event description ID=225, Level=informational, Channel=Analytic
477 /// <param name="InstanceKey">Parameter 0 for event: Calculated correlation key '{0}' using values '{1}' in parent scope '{2}'.</param>
478 /// <param name="Values">Parameter 1 for event: Calculated correlation key '{0}' using values '{1}' in parent scope '{2}'.</param>
479 /// <param name="ParentScope">Parameter 2 for event: Calculated correlation key '{0}' using values '{1}' in parent scope '{2}'.</param>
480 internal static void TraceCorrelationKeys(System.Guid InstanceKey, string Values, string ParentScope)
482 TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null, true);
483 if (TD.IsEtwEventEnabled(14))
485 TD.WriteEtwEvent(14, null, InstanceKey, Values, ParentScope, payload.HostReference, payload.AppDomainFriendlyName);
487 if (FxTrace.ShouldTraceInformationToTraceSource)
489 string description = string.Format(Culture, ResourceManager.GetString("TraceCorrelationKeys", Culture), InstanceKey, Values, ParentScope);
490 TD.WriteTraceSource(14, description, payload);
495 /// Check if trace definition is enabled
496 /// Event description ID=2023, Level=Verbose, Channel=Debug
498 internal static bool SendMessageChannelCacheMissIsEnabled()
500 return (FxTrace.ShouldTraceVerbose && TD.IsEtwEventEnabled(15));
504 /// Gets trace definition like: SendMessageChannelCache miss
505 /// Event description ID=2023, Level=Verbose, Channel=Debug
507 internal static void SendMessageChannelCacheMiss()
509 TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
510 if (TD.IsEtwEventEnabled(15))
512 TD.WriteEtwEvent(15, null, payload.AppDomainFriendlyName);
517 /// Check if trace definition is enabled
518 /// Event description ID=1450, Level=Informational, Channel=Debug
520 internal static bool WfMessageSentIsEnabled()
522 return (FxTrace.ShouldTraceInformation && TD.IsEtwEventEnabled(16));
526 /// Gets trace definition like: Message sent from workflow
527 /// Event description ID=1450, Level=Informational, Channel=Debug
529 /// <param name="eventTraceActivity">The event trace activity</param>
530 /// <param name="relatedActivityId">The related event activity Id</param>
531 internal static void WfMessageSent(System.Runtime.Diagnostics.EventTraceActivity eventTraceActivity, System.Guid relatedActivityId)
533 TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
534 if (TD.IsEtwEventEnabled(16))
536 TD.WriteEtwTransferEvent(16, eventTraceActivity, relatedActivityId, payload.AppDomainFriendlyName);
541 /// Check if trace definition is enabled
542 /// Event description ID=1449, Level=Informational, Channel=Debug
544 internal static bool WfMessageReceivedIsEnabled()
546 return (FxTrace.ShouldTraceInformation && TD.IsEtwEventEnabled(17));
550 /// Gets trace definition like: Message received by workflow
551 /// Event description ID=1449, Level=Informational, Channel=Debug
553 /// <param name="eventTraceActivity">The event trace activity</param>
554 /// <param name="relatedActivityId">The related event activity Id</param>
555 internal static void WfMessageReceived(System.Runtime.Diagnostics.EventTraceActivity eventTraceActivity, System.Guid relatedActivityId)
557 TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
558 if (TD.IsEtwEventEnabled(17))
560 TD.WriteEtwTransferEvent(17, eventTraceActivity, relatedActivityId, payload.AppDomainFriendlyName);
565 /// Check if trace definition is enabled
566 /// Event description ID=1436, Level=verbose, Channel=analytic
568 internal static bool PendingMessagesPerChannelRatioIsEnabled()
570 return (FxTrace.ShouldTraceVerbose && TD.IsEtwEventEnabled(18));
574 /// Gets trace definition like: Pending messages per channel ratio: {0}/{1}
575 /// Event description ID=1436, Level=verbose, Channel=analytic
577 /// <param name="cur">Parameter 0 for event: Pending messages per channel ratio: {0}/{1}</param>
578 /// <param name="max">Parameter 1 for event: Pending messages per channel ratio: {0}/{1}</param>
579 internal static void PendingMessagesPerChannelRatio(int cur, int max)
581 TracePayload payload = FxTrace.Trace.GetSerializedPayload(null, null, null);
582 if (TD.IsEtwEventEnabled(18))
584 TD.WriteEtwEvent(18, null, cur, max, payload.AppDomainFriendlyName);
589 /// Creates the event descriptors array
591 // Critical = Sets the SecurityCritical member eventDescriptors
592 // Safe = We control what the event descriptors contain
593 [System.Security.SecuritySafeCriticalAttribute()]
594 static void CreateEventDescriptors()
596 System.Runtime.Diagnostics.EventDescriptor[] descriptors = new System.Runtime.Diagnostics.EventDescriptor[] {
597 new System.Runtime.Diagnostics.EventDescriptor(57398, 0, (byte)TraceChannel.Analytic, (byte)TraceEventLevel.Warning, (byte)TraceEventOpcode.Info, 0xa22, 0x2000000004000000),
598 new System.Runtime.Diagnostics.EventDescriptor(3501, 0, (byte)TraceChannel.Analytic, (byte)TraceEventLevel.Informational, (byte)69, 0x9f4, 0x2000000004000000),
599 new System.Runtime.Diagnostics.EventDescriptor(3502, 0, (byte)TraceChannel.Analytic, (byte)TraceEventLevel.Informational, (byte)70, 0x9f4, 0x2000000004000000),
600 new System.Runtime.Diagnostics.EventDescriptor(3503, 0, (byte)TraceChannel.Analytic, (byte)TraceEventLevel.Warning, (byte)28, 0x9db, 0x2000000004000000),
601 new System.Runtime.Diagnostics.EventDescriptor(3507, 0, (byte)TraceChannel.Analytic, (byte)TraceEventLevel.Informational, (byte)TraceEventOpcode.Info, 0x9cb, 0x2000000004000000),
602 new System.Runtime.Diagnostics.EventDescriptor(440, 0, (byte)TraceChannel.Analytic, (byte)TraceEventLevel.Informational, (byte)TraceEventOpcode.Start, 0xa1c, 0x2000000004080000),
603 new System.Runtime.Diagnostics.EventDescriptor(441, 0, (byte)TraceChannel.Analytic, (byte)TraceEventLevel.Informational, (byte)TraceEventOpcode.Stop, 0xa1c, 0x2000000004080000),
604 new System.Runtime.Diagnostics.EventDescriptor(3550, 0, (byte)TraceChannel.Analytic, (byte)TraceEventLevel.Informational, (byte)11, 0x9cc, 0x2000000004000000),
605 new System.Runtime.Diagnostics.EventDescriptor(3551, 0, (byte)TraceChannel.Analytic, (byte)TraceEventLevel.Informational, (byte)10, 0x9cc, 0x2000000004000000),
606 new System.Runtime.Diagnostics.EventDescriptor(3552, 0, (byte)TraceChannel.Analytic, (byte)TraceEventLevel.Warning, (byte)TraceEventOpcode.Info, 0xa00, 0x2000000004400000),
607 new System.Runtime.Diagnostics.EventDescriptor(3555, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Informational, (byte)TraceEventOpcode.Start, 0x9de, 0x1000000000000080),
608 new System.Runtime.Diagnostics.EventDescriptor(3556, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Informational, (byte)TraceEventOpcode.Stop, 0x9de, 0x1000000000000080),
609 new System.Runtime.Diagnostics.EventDescriptor(3557, 0, (byte)TraceChannel.Analytic, (byte)TraceEventLevel.Informational, (byte)TraceEventOpcode.Info, 0xa08, 0x2000000004000000),
610 new System.Runtime.Diagnostics.EventDescriptor(3508, 0, (byte)TraceChannel.Analytic, (byte)TraceEventLevel.Verbose, (byte)124, 0xa25, 0x2000000004000000),
611 new System.Runtime.Diagnostics.EventDescriptor(225, 0, (byte)TraceChannel.Analytic, (byte)TraceEventLevel.Informational, (byte)TraceEventOpcode.Info, 0x9db, 0x2000000004080000),
612 new System.Runtime.Diagnostics.EventDescriptor(2023, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Verbose, (byte)76, 0x9fa, 0x1000000001000000),
613 new System.Runtime.Diagnostics.EventDescriptor(1450, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Informational, (byte)TraceEventOpcode.Send, 0xa2e, 0x1000000004000000),
614 new System.Runtime.Diagnostics.EventDescriptor(1449, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Informational, (byte)TraceEventOpcode.Receive, 0xa2e, 0x1000000004000000),
615 new System.Runtime.Diagnostics.EventDescriptor(1436, 0, (byte)TraceChannel.Analytic, (byte)TraceEventLevel.Verbose, (byte)TraceEventOpcode.Info, 0xa00, 0x2000000000400000)};
616 // The hashcodes calculated from PTCop for TD.CreateEventDescriptors are unstable when just declaring
617 // a local field of ushort[] if the array is non-empty and contains more than 2 entries, because
618 // the c#-compiler is using some private types for optimization. The type name follows the following pattern:
619 // <PrivateImplementationDetails>{6BAE93FD-290B-4DE0-BCEE-366B30800FDF} (where the GUID is changing with every build)
620 // To scope the change to unblock PTCop as much as possible we wrap the list of End2EndEvents in a List<ushort>
621 System.Collections.Generic.List<ushort> e2eEvents = new System.Collections.Generic.List<ushort>(3);
625 FxTrace.UpdateEventDefinitions(descriptors, e2eEvents.ToArray());
626 eventDescriptors = descriptors;
630 /// Ensures that the event descriptors array is initialized
632 static void EnsureEventDescriptors()
634 if (eventDescriptorsCreated)
638 System.Threading.Monitor.Enter(syncLock);
641 if (eventDescriptorsCreated)
645 CreateEventDescriptors();
646 eventDescriptorsCreated = true;
650 System.Threading.Monitor.Exit(syncLock);
655 /// Check if ETW tracing is enabled for the particular event
657 /// <param name="eventIndex">The index of the event descriptor</param>
658 static bool IsEtwEventEnabled(int eventIndex)
660 if (FxTrace.Trace.IsEtwProviderEnabled)
662 EnsureEventDescriptors();
663 return FxTrace.IsEventEnabled(eventIndex);
669 /// Writes ETW trace event
671 /// <param name="eventIndex">The index of the event descriptor</param>>
672 /// <param name="eventParam0">A parameter of the ETW event</param>>
673 /// <param name="eventParam1">A parameter of the ETW event</param>>
674 /// <param name="eventParam2">A parameter of the ETW event</param>>
675 // Critical = Calls SecurityCritical method EtwProvider.WriteEvent
676 // Safe = We only allow setting of provider id from SecurityCritical code, access to EventDescriptors is SecurityCritical, and ETW limits buffer sizes.
677 [System.Security.SecuritySafeCriticalAttribute()]
678 static bool WriteEtwEvent(int eventIndex, System.Runtime.Diagnostics.EventTraceActivity eventParam0, int eventParam1, string eventParam2)
680 EnsureEventDescriptors();
681 return FxTrace.Trace.EtwProvider.WriteEvent(ref eventDescriptors[eventIndex], eventParam0, eventParam1, eventParam2);
685 /// Writes ETW trace event
687 /// <param name="eventIndex">The index of the event descriptor</param>>
688 /// <param name="eventParam0">A parameter of the ETW event</param>>
689 /// <param name="eventParam1">A parameter of the ETW event</param>>
690 /// <param name="eventParam2">A parameter of the ETW event</param>>
691 /// <param name="eventParam3">A parameter of the ETW event</param>>
692 // Critical = Calls SecurityCritical method EtwProvider.WriteEvent
693 // Safe = We only allow setting of provider id from SecurityCritical code, access to EventDescriptors is SecurityCritical, and ETW limits buffer sizes.
694 [System.Security.SecuritySafeCriticalAttribute()]
695 static bool WriteEtwEvent(int eventIndex, System.Runtime.Diagnostics.EventTraceActivity eventParam0, string eventParam1, string eventParam2, string eventParam3)
697 EnsureEventDescriptors();
698 return FxTrace.Trace.EtwProvider.WriteEvent(ref eventDescriptors[eventIndex], eventParam0, eventParam1, eventParam2, eventParam3);
702 /// Writes ETW trace event
704 /// <param name="eventIndex">The index of the event descriptor</param>>
705 /// <param name="eventParam0">A parameter of the ETW event</param>>
706 /// <param name="eventParam1">A parameter of the ETW event</param>>
707 /// <param name="eventParam2">A parameter of the ETW event</param>>
708 /// <param name="eventParam3">A parameter of the ETW event</param>>
709 /// <param name="eventParam4">A parameter of the ETW event</param>>
710 // Critical = Calls SecurityCritical method EtwProvider.WriteEvent
711 // Safe = We only allow setting of provider id from SecurityCritical code, access to EventDescriptors is SecurityCritical, and ETW limits buffer sizes.
712 [System.Security.SecuritySafeCriticalAttribute()]
713 static bool WriteEtwEvent(int eventIndex, System.Runtime.Diagnostics.EventTraceActivity eventParam0, string eventParam1, string eventParam2, string eventParam3, string eventParam4)
715 EnsureEventDescriptors();
716 return FxTrace.Trace.EtwProvider.WriteEvent(ref eventDescriptors[eventIndex], eventParam0, eventParam1, eventParam2, eventParam3, eventParam4);
720 /// Writes ETW trace event
722 /// <param name="eventIndex">The index of the event descriptor</param>>
723 /// <param name="eventParam0">A parameter of the ETW event</param>>
724 /// <param name="eventParam1">A parameter of the ETW event</param>>
725 /// <param name="eventParam2">A parameter of the ETW event</param>>
726 // Critical = Calls SecurityCritical method EtwProvider.WriteEvent
727 // Safe = We only allow setting of provider id from SecurityCritical code, access to EventDescriptors is SecurityCritical, and ETW limits buffer sizes.
728 [System.Security.SecuritySafeCriticalAttribute()]
729 static bool WriteEtwEvent(int eventIndex, System.Runtime.Diagnostics.EventTraceActivity eventParam0, string eventParam1, string eventParam2)
731 EnsureEventDescriptors();
732 return FxTrace.Trace.EtwProvider.WriteEvent(ref eventDescriptors[eventIndex], eventParam0, eventParam1, eventParam2);
736 /// Writes ETW trace event
738 /// <param name="eventIndex">The index of the event descriptor</param>>
739 /// <param name="eventParam0">A parameter of the ETW event</param>>
740 /// <param name="eventParam1">A parameter of the ETW event</param>>
741 // Critical = Calls SecurityCritical method EtwProvider.WriteEvent
742 // Safe = We only allow setting of provider id from SecurityCritical code, access to EventDescriptors is SecurityCritical, and ETW limits buffer sizes.
743 [System.Security.SecuritySafeCriticalAttribute()]
744 static bool WriteEtwEvent(int eventIndex, System.Runtime.Diagnostics.EventTraceActivity eventParam0, string eventParam1)
746 EnsureEventDescriptors();
747 return FxTrace.Trace.EtwProvider.WriteEvent(ref eventDescriptors[eventIndex], eventParam0, eventParam1);
751 /// Writes ETW trace event
753 /// <param name="eventIndex">The index of the event descriptor</param>>
754 /// <param name="eventParam0">A parameter of the ETW event</param>>
755 /// <param name="eventParam1">A parameter of the ETW event</param>>
756 /// <param name="eventParam2">A parameter of the ETW event</param>>
757 /// <param name="eventParam3">A parameter of the ETW event</param>>
758 /// <param name="eventParam4">A parameter of the ETW event</param>>
759 /// <param name="eventParam5">A parameter of the ETW event</param>>
760 // Critical = Calls SecurityCritical method EtwProvider.WriteEvent
761 // Safe = We only allow setting of provider id from SecurityCritical code, access to EventDescriptors is SecurityCritical, and ETW limits buffer sizes.
762 [System.Security.SecuritySafeCriticalAttribute()]
763 static bool WriteEtwEvent(int eventIndex, System.Runtime.Diagnostics.EventTraceActivity eventParam0, System.Guid eventParam1, string eventParam2, string eventParam3, string eventParam4, string eventParam5)
765 EnsureEventDescriptors();
766 return FxTrace.Trace.EtwProvider.WriteEvent(ref eventDescriptors[eventIndex], eventParam0, eventParam1, eventParam2, eventParam3, eventParam4, eventParam5);
770 /// Writes ETW trace event
772 /// <param name="eventIndex">The index of the event descriptor</param>>
773 /// <param name="eventParam0">A parameter of the ETW event</param>>
774 /// <param name="eventParam1">A parameter of the ETW event</param>>
775 /// <param name="eventParam2">A parameter of the ETW event</param>>
776 /// <param name="eventParam3">A parameter of the ETW event</param>>
777 // Critical = Calls SecurityCritical method EtwProvider.WriteEvent
778 // Safe = We only allow setting of provider id from SecurityCritical code, access to EventDescriptors is SecurityCritical, and ETW limits buffer sizes.
779 [System.Security.SecuritySafeCriticalAttribute()]
780 static bool WriteEtwEvent(int eventIndex, System.Runtime.Diagnostics.EventTraceActivity eventParam0, int eventParam1, int eventParam2, string eventParam3)
782 EnsureEventDescriptors();
783 return FxTrace.Trace.EtwProvider.WriteEvent(ref eventDescriptors[eventIndex], eventParam0, eventParam1, eventParam2, eventParam3);
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 /// <param name="eventParam2">A parameter of the ETW event</param>>
793 // Critical = Calls SecurityCritical method EtwProvider.WriteEvent
794 // Safe = We only allow setting of provider id from SecurityCritical code, access to EventDescriptors is SecurityCritical, and ETW limits buffer sizes.
795 [System.Security.SecuritySafeCriticalAttribute()]
796 static bool WriteEtwTransferEvent(int eventIndex, System.Runtime.Diagnostics.EventTraceActivity eventParam0, System.Guid eventParam1, string eventParam2)
798 EnsureEventDescriptors();
799 return FxTrace.Trace.EtwProvider.WriteTransferEvent(ref eventDescriptors[eventIndex], eventParam0, eventParam1, eventParam2);
803 /// write a trace source into the diagnostic trace
805 /// <param name="eventIndex">The index of the event descriptor</param>
806 /// <param name="description">The description to write</param>
807 /// <param name="payload">The trace payload</param>
808 // Critical = Calls SecurityCritical method EtwDiagnosticTrace.WriteTraceSource
809 // Safe = We only allow setting of provider id from SecurityCritical code
810 [System.Security.SecuritySafeCriticalAttribute()]
811 static void WriteTraceSource(int eventIndex, string description, TracePayload payload)
813 EnsureEventDescriptors();
814 FxTrace.Trace.WriteTraceSource(ref eventDescriptors[eventIndex], description, payload);