1 //------------------------------------------------------------------------------ 2 // <auto-generated> 3 // This code was generated by a tool. 4 // 5 // Changes to this file may cause incorrect behavior and will be lost if 6 // the code is regenerated. 7 // </auto-generated> 8 //------------------------------------------------------------------------------ 9 10 namespace System.Runtime 11 { 12 using System.Runtime.Diagnostics; 13 using System.Security; 14 15 16 internal partial class TraceCore 17 { 18 19 static System.Resources.ResourceManager resourceManager; 20 21 static System.Globalization.CultureInfo resourceCulture; 22 23 [System.Security.SecurityCriticalAttribute()] 24 static System.Runtime.Diagnostics.EventDescriptor[] eventDescriptors; 25 26 static object syncLock = new object(); 27 28 // Double-checked locking pattern requires volatile for read/write synchronization 29 static volatile bool eventDescriptorsCreated; 30 TraceCore()31 private TraceCore() 32 { 33 } 34 35 [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification="This is an auto-generated code, some ETW/TraceSource mixed code would use it.")] 36 static System.Resources.ResourceManager ResourceManager 37 { 38 get 39 { 40 if (object.ReferenceEquals(resourceManager, null)) 41 { 42 resourceManager = new System.Resources.ResourceManager("System.Runtime.TraceCore", typeof(TraceCore).Assembly); 43 } 44 return resourceManager; 45 } 46 } 47 48 [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification="This template is shared across all assemblies, some of which use this accessor.")] 49 internal static System.Globalization.CultureInfo Culture 50 { 51 get 52 { 53 return resourceCulture; 54 } 55 set 56 { 57 resourceCulture = value; 58 } 59 } 60 61 /// <summary> 62 /// Check if trace definition is enabled 63 /// Event description ID=57393, Level=informational, Channel=Debug 64 /// </summary> 65 /// <param name="trace">The trace provider</param> AppDomainUnloadIsEnabled(EtwDiagnosticTrace trace)66 internal static bool AppDomainUnloadIsEnabled(EtwDiagnosticTrace trace) 67 { 68 return (trace.ShouldTrace(TraceEventLevel.Informational) || TraceCore.IsEtwEventEnabled(trace, 0)); 69 } 70 71 /// <summary> 72 /// Gets trace definition like: AppDomain unloading. AppDomain.FriendlyName {0}, ProcessName {1}, ProcessId {2}. 73 /// Event description ID=57393, Level=informational, Channel=Debug 74 /// </summary> 75 /// <param name="trace">The trace provider</param> 76 /// <param name="appdomainName">Parameter 0 for event: AppDomain unloading. AppDomain.FriendlyName {0}, ProcessName {1}, ProcessId {2}.</param> 77 /// <param name="processName">Parameter 1 for event: AppDomain unloading. AppDomain.FriendlyName {0}, ProcessName {1}, ProcessId {2}.</param> 78 /// <param name="processId">Parameter 2 for event: AppDomain unloading. AppDomain.FriendlyName {0}, ProcessName {1}, ProcessId {2}.</param> AppDomainUnload(EtwDiagnosticTrace trace, string appdomainName, string processName, string processId)79 internal static void AppDomainUnload(EtwDiagnosticTrace trace, string appdomainName, string processName, string processId) 80 { 81 TracePayload payload = trace.GetSerializedPayload(null, null, null); 82 if (TraceCore.IsEtwEventEnabled(trace, 0)) 83 { 84 TraceCore.WriteEtwEvent(trace, 0, null, appdomainName, processName, processId, payload.AppDomainFriendlyName); 85 } 86 if (trace.ShouldTraceToTraceSource(TraceEventLevel.Informational)) 87 { 88 string description = string.Format(Culture, ResourceManager.GetString("AppDomainUnload", Culture), appdomainName, processName, processId); 89 TraceCore.WriteTraceSource(trace, 0, description, payload); 90 } 91 } 92 93 /// <summary> 94 /// Check if trace definition is enabled 95 /// Event description ID=57394, Level=informational, Channel=Analytic 96 /// </summary> 97 /// <param name="trace">The trace provider</param> HandledExceptionIsEnabled(EtwDiagnosticTrace trace)98 internal static bool HandledExceptionIsEnabled(EtwDiagnosticTrace trace) 99 { 100 return (trace.ShouldTrace(TraceEventLevel.Informational) || TraceCore.IsEtwEventEnabled(trace, 1)); 101 } 102 103 /// <summary> 104 /// Gets trace definition like: Handling an exception. Exception details: {0} 105 /// Event description ID=57394, Level=informational, Channel=Analytic 106 /// </summary> 107 /// <param name="trace">The trace provider</param> 108 /// <param name="param0">Parameter 0 for event: Handling an exception. Exception details: {0}</param> 109 /// <param name="exception">Exception associated with the event</param> HandledException(EtwDiagnosticTrace trace, string param0, System.Exception exception)110 internal static void HandledException(EtwDiagnosticTrace trace, string param0, System.Exception exception) 111 { 112 TracePayload payload = trace.GetSerializedPayload(null, null, exception); 113 if (TraceCore.IsEtwEventEnabled(trace, 1)) 114 { 115 TraceCore.WriteEtwEvent(trace, 1, null, param0, payload.SerializedException, payload.AppDomainFriendlyName); 116 } 117 if (trace.ShouldTraceToTraceSource(TraceEventLevel.Informational)) 118 { 119 string description = string.Format(Culture, ResourceManager.GetString("HandledException", Culture), param0); 120 TraceCore.WriteTraceSource(trace, 1, description, payload); 121 } 122 } 123 124 /// <summary> 125 /// Check if trace definition is enabled 126 /// Event description ID=57395, Level=error, Channel=Analytic 127 /// </summary> 128 /// <param name="trace">The trace provider</param> ShipAssertExceptionMessageIsEnabled(EtwDiagnosticTrace trace)129 internal static bool ShipAssertExceptionMessageIsEnabled(EtwDiagnosticTrace trace) 130 { 131 return (trace.ShouldTrace(TraceEventLevel.Error) || TraceCore.IsEtwEventEnabled(trace, 2)); 132 } 133 134 /// <summary> 135 /// Gets trace definition like: An unexpected failure occurred. Applications should not attempt to handle this error. For diagnostic purposes, this English message is associated with the failure: {0}. 136 /// Event description ID=57395, Level=error, Channel=Analytic 137 /// </summary> 138 /// <param name="trace">The trace provider</param> 139 /// <param name="param0">Parameter 0 for event: An unexpected failure occurred. Applications should not attempt to handle this error. For diagnostic purposes, this English message is associated with the failure: {0}.</param> ShipAssertExceptionMessage(EtwDiagnosticTrace trace, string param0)140 internal static void ShipAssertExceptionMessage(EtwDiagnosticTrace trace, string param0) 141 { 142 TracePayload payload = trace.GetSerializedPayload(null, null, null); 143 if (TraceCore.IsEtwEventEnabled(trace, 2)) 144 { 145 TraceCore.WriteEtwEvent(trace, 2, null, param0, payload.AppDomainFriendlyName); 146 } 147 if (trace.ShouldTraceToTraceSource(TraceEventLevel.Error)) 148 { 149 string description = string.Format(Culture, ResourceManager.GetString("ShipAssertExceptionMessage", Culture), param0); 150 TraceCore.WriteTraceSource(trace, 2, description, payload); 151 } 152 } 153 154 /// <summary> 155 /// Check if trace definition is enabled 156 /// Event description ID=57396, Level=warning, Channel=Analytic 157 /// </summary> 158 /// <param name="trace">The trace provider</param> ThrowingExceptionIsEnabled(EtwDiagnosticTrace trace)159 internal static bool ThrowingExceptionIsEnabled(EtwDiagnosticTrace trace) 160 { 161 return (trace.ShouldTrace(TraceEventLevel.Warning) || TraceCore.IsEtwEventEnabled(trace, 3)); 162 } 163 164 /// <summary> 165 /// Gets trace definition like: Throwing an exception. Source: {0}. Exception details: {1} 166 /// Event description ID=57396, Level=warning, Channel=Analytic 167 /// </summary> 168 /// <param name="trace">The trace provider</param> 169 /// <param name="param0">Parameter 0 for event: Throwing an exception. Source: {0}. Exception details: {1}</param> 170 /// <param name="param1">Parameter 1 for event: Throwing an exception. Source: {0}. Exception details: {1}</param> 171 /// <param name="exception">Exception associated with the event</param> ThrowingException(EtwDiagnosticTrace trace, string param0, string param1, System.Exception exception)172 internal static void ThrowingException(EtwDiagnosticTrace trace, string param0, string param1, System.Exception exception) 173 { 174 TracePayload payload = trace.GetSerializedPayload(null, null, exception); 175 if (TraceCore.IsEtwEventEnabled(trace, 3)) 176 { 177 TraceCore.WriteEtwEvent(trace, 3, null, param0, param1, payload.SerializedException, payload.AppDomainFriendlyName); 178 } 179 if (trace.ShouldTraceToTraceSource(TraceEventLevel.Warning)) 180 { 181 string description = string.Format(Culture, ResourceManager.GetString("ThrowingException", Culture), param0, param1); 182 TraceCore.WriteTraceSource(trace, 3, description, payload); 183 } 184 } 185 186 /// <summary> 187 /// Check if trace definition is enabled 188 /// Event description ID=57397, Level=critical, Channel=Operational 189 /// </summary> 190 /// <param name="trace">The trace provider</param> UnhandledExceptionIsEnabled(EtwDiagnosticTrace trace)191 internal static bool UnhandledExceptionIsEnabled(EtwDiagnosticTrace trace) 192 { 193 return (trace.ShouldTrace(TraceEventLevel.Critical) || TraceCore.IsEtwEventEnabled(trace, 4)); 194 } 195 196 /// <summary> 197 /// Gets trace definition like: Unhandled exception. Exception details: {0} 198 /// Event description ID=57397, Level=critical, Channel=Operational 199 /// </summary> 200 /// <param name="trace">The trace provider</param> 201 /// <param name="param0">Parameter 0 for event: Unhandled exception. Exception details: {0}</param> 202 /// <param name="exception">Exception associated with the event</param> UnhandledException(EtwDiagnosticTrace trace, string param0, System.Exception exception)203 internal static void UnhandledException(EtwDiagnosticTrace trace, string param0, System.Exception exception) 204 { 205 TracePayload payload = trace.GetSerializedPayload(null, null, exception); 206 if (TraceCore.IsEtwEventEnabled(trace, 4)) 207 { 208 TraceCore.WriteEtwEvent(trace, 4, null, param0, payload.SerializedException, payload.AppDomainFriendlyName); 209 } 210 if (trace.ShouldTraceToTraceSource(TraceEventLevel.Critical)) 211 { 212 string description = string.Format(Culture, ResourceManager.GetString("UnhandledException", Culture), param0); 213 TraceCore.WriteTraceSource(trace, 4, description, payload); 214 } 215 } 216 217 /// <summary> 218 /// Check if trace definition is enabled 219 /// Event description ID=57399, Level=critical, Channel=Debug 220 /// </summary> 221 /// <param name="trace">The trace provider</param> TraceCodeEventLogCriticalIsEnabled(EtwDiagnosticTrace trace)222 internal static bool TraceCodeEventLogCriticalIsEnabled(EtwDiagnosticTrace trace) 223 { 224 return (trace.ShouldTrace(TraceEventLevel.Critical) || TraceCore.IsEtwEventEnabled(trace, 5)); 225 } 226 227 /// <summary> 228 /// Gets trace definition like: Wrote to the EventLog. 229 /// Event description ID=57399, Level=critical, Channel=Debug 230 /// </summary> 231 /// <param name="trace">The trace provider</param> 232 /// <param name="traceRecord">Extended data (TraceRecord) for the event</param> TraceCodeEventLogCritical(EtwDiagnosticTrace trace, TraceRecord traceRecord)233 internal static void TraceCodeEventLogCritical(EtwDiagnosticTrace trace, TraceRecord traceRecord) 234 { 235 TracePayload payload = trace.GetSerializedPayload(null, traceRecord, null); 236 if (TraceCore.IsEtwEventEnabled(trace, 5)) 237 { 238 TraceCore.WriteEtwEvent(trace, 5, null, payload.ExtendedData, payload.AppDomainFriendlyName); 239 } 240 if (trace.ShouldTraceToTraceSource(TraceEventLevel.Critical)) 241 { 242 string description = string.Format(Culture, ResourceManager.GetString("TraceCodeEventLogCritical", Culture)); 243 TraceCore.WriteTraceSource(trace, 5, description, payload); 244 } 245 } 246 247 /// <summary> 248 /// Check if trace definition is enabled 249 /// Event description ID=57400, Level=error, Channel=Debug 250 /// </summary> 251 /// <param name="trace">The trace provider</param> TraceCodeEventLogErrorIsEnabled(EtwDiagnosticTrace trace)252 internal static bool TraceCodeEventLogErrorIsEnabled(EtwDiagnosticTrace trace) 253 { 254 return (trace.ShouldTrace(TraceEventLevel.Error) || TraceCore.IsEtwEventEnabled(trace, 6)); 255 } 256 257 /// <summary> 258 /// Gets trace definition like: Wrote to the EventLog. 259 /// Event description ID=57400, Level=error, Channel=Debug 260 /// </summary> 261 /// <param name="trace">The trace provider</param> 262 /// <param name="traceRecord">Extended data (TraceRecord) for the event</param> TraceCodeEventLogError(EtwDiagnosticTrace trace, TraceRecord traceRecord)263 internal static void TraceCodeEventLogError(EtwDiagnosticTrace trace, TraceRecord traceRecord) 264 { 265 TracePayload payload = trace.GetSerializedPayload(null, traceRecord, null); 266 if (TraceCore.IsEtwEventEnabled(trace, 6)) 267 { 268 TraceCore.WriteEtwEvent(trace, 6, null, payload.ExtendedData, payload.AppDomainFriendlyName); 269 } 270 if (trace.ShouldTraceToTraceSource(TraceEventLevel.Error)) 271 { 272 string description = string.Format(Culture, ResourceManager.GetString("TraceCodeEventLogError", Culture)); 273 TraceCore.WriteTraceSource(trace, 6, description, payload); 274 } 275 } 276 277 /// <summary> 278 /// Check if trace definition is enabled 279 /// Event description ID=57401, Level=informational, Channel=Debug 280 /// </summary> 281 /// <param name="trace">The trace provider</param> TraceCodeEventLogInfoIsEnabled(EtwDiagnosticTrace trace)282 internal static bool TraceCodeEventLogInfoIsEnabled(EtwDiagnosticTrace trace) 283 { 284 return (trace.ShouldTrace(TraceEventLevel.Informational) || TraceCore.IsEtwEventEnabled(trace, 7)); 285 } 286 287 /// <summary> 288 /// Gets trace definition like: Wrote to the EventLog. 289 /// Event description ID=57401, Level=informational, Channel=Debug 290 /// </summary> 291 /// <param name="trace">The trace provider</param> 292 /// <param name="traceRecord">Extended data (TraceRecord) for the event</param> TraceCodeEventLogInfo(EtwDiagnosticTrace trace, TraceRecord traceRecord)293 internal static void TraceCodeEventLogInfo(EtwDiagnosticTrace trace, TraceRecord traceRecord) 294 { 295 TracePayload payload = trace.GetSerializedPayload(null, traceRecord, null); 296 if (TraceCore.IsEtwEventEnabled(trace, 7)) 297 { 298 TraceCore.WriteEtwEvent(trace, 7, null, payload.ExtendedData, payload.AppDomainFriendlyName); 299 } 300 if (trace.ShouldTraceToTraceSource(TraceEventLevel.Informational)) 301 { 302 string description = string.Format(Culture, ResourceManager.GetString("TraceCodeEventLogInfo", Culture)); 303 TraceCore.WriteTraceSource(trace, 7, description, payload); 304 } 305 } 306 307 /// <summary> 308 /// Check if trace definition is enabled 309 /// Event description ID=57402, Level=verbose, Channel=Debug 310 /// </summary> 311 /// <param name="trace">The trace provider</param> TraceCodeEventLogVerboseIsEnabled(EtwDiagnosticTrace trace)312 internal static bool TraceCodeEventLogVerboseIsEnabled(EtwDiagnosticTrace trace) 313 { 314 return (trace.ShouldTrace(TraceEventLevel.Verbose) || TraceCore.IsEtwEventEnabled(trace, 8)); 315 } 316 317 /// <summary> 318 /// Gets trace definition like: Wrote to the EventLog. 319 /// Event description ID=57402, Level=verbose, Channel=Debug 320 /// </summary> 321 /// <param name="trace">The trace provider</param> 322 /// <param name="traceRecord">Extended data (TraceRecord) for the event</param> TraceCodeEventLogVerbose(EtwDiagnosticTrace trace, TraceRecord traceRecord)323 internal static void TraceCodeEventLogVerbose(EtwDiagnosticTrace trace, TraceRecord traceRecord) 324 { 325 TracePayload payload = trace.GetSerializedPayload(null, traceRecord, null); 326 if (TraceCore.IsEtwEventEnabled(trace, 8)) 327 { 328 TraceCore.WriteEtwEvent(trace, 8, null, payload.ExtendedData, payload.AppDomainFriendlyName); 329 } 330 if (trace.ShouldTraceToTraceSource(TraceEventLevel.Verbose)) 331 { 332 string description = string.Format(Culture, ResourceManager.GetString("TraceCodeEventLogVerbose", Culture)); 333 TraceCore.WriteTraceSource(trace, 8, description, payload); 334 } 335 } 336 337 /// <summary> 338 /// Check if trace definition is enabled 339 /// Event description ID=57403, Level=warning, Channel=Debug 340 /// </summary> 341 /// <param name="trace">The trace provider</param> TraceCodeEventLogWarningIsEnabled(EtwDiagnosticTrace trace)342 internal static bool TraceCodeEventLogWarningIsEnabled(EtwDiagnosticTrace trace) 343 { 344 return (trace.ShouldTrace(TraceEventLevel.Warning) || TraceCore.IsEtwEventEnabled(trace, 9)); 345 } 346 347 /// <summary> 348 /// Gets trace definition like: Wrote to the EventLog. 349 /// Event description ID=57403, Level=warning, Channel=Debug 350 /// </summary> 351 /// <param name="trace">The trace provider</param> 352 /// <param name="traceRecord">Extended data (TraceRecord) for the event</param> TraceCodeEventLogWarning(EtwDiagnosticTrace trace, TraceRecord traceRecord)353 internal static void TraceCodeEventLogWarning(EtwDiagnosticTrace trace, TraceRecord traceRecord) 354 { 355 TracePayload payload = trace.GetSerializedPayload(null, traceRecord, null); 356 if (TraceCore.IsEtwEventEnabled(trace, 9)) 357 { 358 TraceCore.WriteEtwEvent(trace, 9, null, payload.ExtendedData, payload.AppDomainFriendlyName); 359 } 360 if (trace.ShouldTraceToTraceSource(TraceEventLevel.Warning)) 361 { 362 string description = string.Format(Culture, ResourceManager.GetString("TraceCodeEventLogWarning", Culture)); 363 TraceCore.WriteTraceSource(trace, 9, description, payload); 364 } 365 } 366 367 /// <summary> 368 /// Check if trace definition is enabled 369 /// Event description ID=57404, Level=warning, Channel=Analytic 370 /// </summary> 371 /// <param name="trace">The trace provider</param> HandledExceptionWarningIsEnabled(EtwDiagnosticTrace trace)372 internal static bool HandledExceptionWarningIsEnabled(EtwDiagnosticTrace trace) 373 { 374 return (trace.ShouldTrace(TraceEventLevel.Warning) || TraceCore.IsEtwEventEnabled(trace, 10)); 375 } 376 377 /// <summary> 378 /// Gets trace definition like: Handling an exception. Exception details: {0} 379 /// Event description ID=57404, Level=warning, Channel=Analytic 380 /// </summary> 381 /// <param name="trace">The trace provider</param> 382 /// <param name="param0">Parameter 0 for event: Handling an exception. Exception details: {0}</param> 383 /// <param name="exception">Exception associated with the event</param> HandledExceptionWarning(EtwDiagnosticTrace trace, string param0, System.Exception exception)384 internal static void HandledExceptionWarning(EtwDiagnosticTrace trace, string param0, System.Exception exception) 385 { 386 TracePayload payload = trace.GetSerializedPayload(null, null, exception); 387 if (TraceCore.IsEtwEventEnabled(trace, 10)) 388 { 389 TraceCore.WriteEtwEvent(trace, 10, null, param0, payload.SerializedException, payload.AppDomainFriendlyName); 390 } 391 if (trace.ShouldTraceToTraceSource(TraceEventLevel.Warning)) 392 { 393 string description = string.Format(Culture, ResourceManager.GetString("HandledExceptionWarning", Culture), param0); 394 TraceCore.WriteTraceSource(trace, 10, description, payload); 395 } 396 } 397 398 /// <summary> 399 /// Check if trace definition is enabled 400 /// Event description ID=131, Level=verbose, Channel=Debug 401 /// </summary> 402 /// <param name="trace">The trace provider</param> BufferPoolAllocationIsEnabled(EtwDiagnosticTrace trace)403 internal static bool BufferPoolAllocationIsEnabled(EtwDiagnosticTrace trace) 404 { 405 return TraceCore.IsEtwEventEnabled(trace, 11); 406 } 407 408 /// <summary> 409 /// Gets trace definition like: Pool allocating {0} Bytes. 410 /// Event description ID=131, Level=verbose, Channel=Debug 411 /// </summary> 412 /// <param name="trace">The trace provider</param> 413 /// <param name="Size">Parameter 0 for event: Pool allocating {0} Bytes.</param> BufferPoolAllocation(EtwDiagnosticTrace trace, int Size)414 internal static void BufferPoolAllocation(EtwDiagnosticTrace trace, int Size) 415 { 416 TracePayload payload = trace.GetSerializedPayload(null, null, null); 417 if (TraceCore.IsEtwEventEnabled(trace, 11)) 418 { 419 TraceCore.WriteEtwEvent(trace, 11, null, Size, payload.AppDomainFriendlyName); 420 } 421 } 422 423 /// <summary> 424 /// Check if trace definition is enabled 425 /// Event description ID=132, Level=verbose, Channel=Debug 426 /// </summary> 427 /// <param name="trace">The trace provider</param> BufferPoolChangeQuotaIsEnabled(EtwDiagnosticTrace trace)428 internal static bool BufferPoolChangeQuotaIsEnabled(EtwDiagnosticTrace trace) 429 { 430 return TraceCore.IsEtwEventEnabled(trace, 12); 431 } 432 433 /// <summary> 434 /// Gets trace definition like: BufferPool of size {0}, changing quota by {1}. 435 /// Event description ID=132, Level=verbose, Channel=Debug 436 /// </summary> 437 /// <param name="trace">The trace provider</param> 438 /// <param name="PoolSize">Parameter 0 for event: BufferPool of size {0}, changing quota by {1}.</param> 439 /// <param name="Delta">Parameter 1 for event: BufferPool of size {0}, changing quota by {1}.</param> BufferPoolChangeQuota(EtwDiagnosticTrace trace, int PoolSize, int Delta)440 internal static void BufferPoolChangeQuota(EtwDiagnosticTrace trace, int PoolSize, int Delta) 441 { 442 TracePayload payload = trace.GetSerializedPayload(null, null, null); 443 if (TraceCore.IsEtwEventEnabled(trace, 12)) 444 { 445 TraceCore.WriteEtwEvent(trace, 12, null, PoolSize, Delta, payload.AppDomainFriendlyName); 446 } 447 } 448 449 /// <summary> 450 /// Check if trace definition is enabled 451 /// Event description ID=133, Level=verbose, Channel=Debug 452 /// </summary> 453 /// <param name="trace">The trace provider</param> ActionItemScheduledIsEnabled(EtwDiagnosticTrace trace)454 internal static bool ActionItemScheduledIsEnabled(EtwDiagnosticTrace trace) 455 { 456 return TraceCore.IsEtwEventEnabled(trace, 13); 457 } 458 459 /// <summary> 460 /// Gets trace definition like: IO Thread scheduler callback invoked. 461 /// Event description ID=133, Level=verbose, Channel=Debug 462 /// </summary> 463 /// <param name="trace">The trace provider</param> 464 /// <param name="eventTraceActivity">The event trace activity</param> ActionItemScheduled(EtwDiagnosticTrace trace, System.Runtime.Diagnostics.EventTraceActivity eventTraceActivity)465 internal static void ActionItemScheduled(EtwDiagnosticTrace trace, System.Runtime.Diagnostics.EventTraceActivity eventTraceActivity) 466 { 467 TracePayload payload = trace.GetSerializedPayload(null, null, null); 468 if (TraceCore.IsEtwEventEnabled(trace, 13)) 469 { 470 TraceCore.WriteEtwEvent(trace, 13, eventTraceActivity, payload.AppDomainFriendlyName); 471 } 472 } 473 474 /// <summary> 475 /// Check if trace definition is enabled 476 /// Event description ID=134, Level=verbose, Channel=Debug 477 /// </summary> 478 /// <param name="trace">The trace provider</param> ActionItemCallbackInvokedIsEnabled(EtwDiagnosticTrace trace)479 internal static bool ActionItemCallbackInvokedIsEnabled(EtwDiagnosticTrace trace) 480 { 481 return TraceCore.IsEtwEventEnabled(trace, 14); 482 } 483 484 /// <summary> 485 /// Gets trace definition like: IO Thread scheduler callback invoked. 486 /// Event description ID=134, Level=verbose, Channel=Debug 487 /// </summary> 488 /// <param name="trace">The trace provider</param> 489 /// <param name="eventTraceActivity">The event trace activity</param> ActionItemCallbackInvoked(EtwDiagnosticTrace trace, System.Runtime.Diagnostics.EventTraceActivity eventTraceActivity)490 internal static void ActionItemCallbackInvoked(EtwDiagnosticTrace trace, System.Runtime.Diagnostics.EventTraceActivity eventTraceActivity) 491 { 492 TracePayload payload = trace.GetSerializedPayload(null, null, null); 493 if (TraceCore.IsEtwEventEnabled(trace, 14)) 494 { 495 TraceCore.WriteEtwEvent(trace, 14, eventTraceActivity, payload.AppDomainFriendlyName); 496 } 497 } 498 499 /// <summary> 500 /// Check if trace definition is enabled 501 /// Event description ID=57405, Level=error, Channel=Operational 502 /// </summary> 503 /// <param name="trace">The trace provider</param> HandledExceptionErrorIsEnabled(EtwDiagnosticTrace trace)504 internal static bool HandledExceptionErrorIsEnabled(EtwDiagnosticTrace trace) 505 { 506 return (trace.ShouldTrace(TraceEventLevel.Error) || TraceCore.IsEtwEventEnabled(trace, 15)); 507 } 508 509 /// <summary> 510 /// Gets trace definition like: Handling an exception. Exception details: {0} 511 /// Event description ID=57405, Level=error, Channel=Operational 512 /// </summary> 513 /// <param name="trace">The trace provider</param> 514 /// <param name="param0">Parameter 0 for event: Handling an exception. Exception details: {0}</param> 515 /// <param name="exception">Exception associated with the event</param> HandledExceptionError(EtwDiagnosticTrace trace, string param0, System.Exception exception)516 internal static void HandledExceptionError(EtwDiagnosticTrace trace, string param0, System.Exception exception) 517 { 518 TracePayload payload = trace.GetSerializedPayload(null, null, exception); 519 if (TraceCore.IsEtwEventEnabled(trace, 15)) 520 { 521 TraceCore.WriteEtwEvent(trace, 15, null, param0, payload.SerializedException, payload.AppDomainFriendlyName); 522 } 523 if (trace.ShouldTraceToTraceSource(TraceEventLevel.Error)) 524 { 525 string description = string.Format(Culture, ResourceManager.GetString("HandledExceptionError", Culture), param0); 526 TraceCore.WriteTraceSource(trace, 15, description, payload); 527 } 528 } 529 530 /// <summary> 531 /// Check if trace definition is enabled 532 /// Event description ID=57406, Level=verbose, Channel=Analytic 533 /// </summary> 534 /// <param name="trace">The trace provider</param> HandledExceptionVerboseIsEnabled(EtwDiagnosticTrace trace)535 internal static bool HandledExceptionVerboseIsEnabled(EtwDiagnosticTrace trace) 536 { 537 return (trace.ShouldTrace(TraceEventLevel.Verbose) || TraceCore.IsEtwEventEnabled(trace, 16)); 538 } 539 540 /// <summary> 541 /// Gets trace definition like: Handling an exception Exception details: {0} 542 /// Event description ID=57406, Level=verbose, Channel=Analytic 543 /// </summary> 544 /// <param name="trace">The trace provider</param> 545 /// <param name="param0">Parameter 0 for event: Handling an exception Exception details: {0}</param> 546 /// <param name="exception">Exception associated with the event</param> HandledExceptionVerbose(EtwDiagnosticTrace trace, string param0, System.Exception exception)547 internal static void HandledExceptionVerbose(EtwDiagnosticTrace trace, string param0, System.Exception exception) 548 { 549 TracePayload payload = trace.GetSerializedPayload(null, null, exception); 550 if (TraceCore.IsEtwEventEnabled(trace, 16)) 551 { 552 TraceCore.WriteEtwEvent(trace, 16, null, param0, payload.SerializedException, payload.AppDomainFriendlyName); 553 } 554 if (trace.ShouldTraceToTraceSource(TraceEventLevel.Verbose)) 555 { 556 string description = string.Format(Culture, ResourceManager.GetString("HandledExceptionVerbose", Culture), param0); 557 TraceCore.WriteTraceSource(trace, 16, description, payload); 558 } 559 } 560 561 /// <summary> 562 /// Check if trace definition is enabled 563 /// Event description ID=57408, Level=critical, Channel=Operational 564 /// </summary> 565 /// <param name="trace">The trace provider</param> EtwUnhandledExceptionIsEnabled(EtwDiagnosticTrace trace)566 internal static bool EtwUnhandledExceptionIsEnabled(EtwDiagnosticTrace trace) 567 { 568 return TraceCore.IsEtwEventEnabled(trace, 17); 569 } 570 571 /// <summary> 572 /// Gets trace definition like: Unhandled exception. Exception details: {0} 573 /// Event description ID=57408, Level=critical, Channel=Operational 574 /// </summary> 575 /// <param name="trace">The trace provider</param> 576 /// <param name="param0">Parameter 0 for event: Unhandled exception. Exception details: {0}</param> 577 /// <param name="exception">Exception associated with the event</param> EtwUnhandledException(EtwDiagnosticTrace trace, string param0, System.Exception exception)578 internal static void EtwUnhandledException(EtwDiagnosticTrace trace, string param0, System.Exception exception) 579 { 580 TracePayload payload = trace.GetSerializedPayload(null, null, exception); 581 if (TraceCore.IsEtwEventEnabled(trace, 17)) 582 { 583 TraceCore.WriteEtwEvent(trace, 17, null, param0, payload.SerializedException, payload.AppDomainFriendlyName); 584 } 585 } 586 587 /// <summary> 588 /// Check if trace definition is enabled 589 /// Event description ID=57410, Level=warning, Channel=Analytic 590 /// </summary> 591 /// <param name="trace">The trace provider</param> ThrowingEtwExceptionIsEnabled(EtwDiagnosticTrace trace)592 internal static bool ThrowingEtwExceptionIsEnabled(EtwDiagnosticTrace trace) 593 { 594 return TraceCore.IsEtwEventEnabled(trace, 18); 595 } 596 597 /// <summary> 598 /// Gets trace definition like: Throwing an exception. Source: {0}. Exception details: {1} 599 /// Event description ID=57410, Level=warning, Channel=Analytic 600 /// </summary> 601 /// <param name="trace">The trace provider</param> 602 /// <param name="param0">Parameter 0 for event: Throwing an exception. Source: {0}. Exception details: {1}</param> 603 /// <param name="param1">Parameter 1 for event: Throwing an exception. Source: {0}. Exception details: {1}</param> 604 /// <param name="exception">Exception associated with the event</param> ThrowingEtwException(EtwDiagnosticTrace trace, string param0, string param1, System.Exception exception)605 internal static void ThrowingEtwException(EtwDiagnosticTrace trace, string param0, string param1, System.Exception exception) 606 { 607 TracePayload payload = trace.GetSerializedPayload(null, null, exception); 608 if (TraceCore.IsEtwEventEnabled(trace, 18)) 609 { 610 TraceCore.WriteEtwEvent(trace, 18, null, param0, param1, payload.SerializedException, payload.AppDomainFriendlyName); 611 } 612 } 613 614 /// <summary> 615 /// Check if trace definition is enabled 616 /// Event description ID=57409, Level=verbose, Channel=Analytic 617 /// </summary> 618 /// <param name="trace">The trace provider</param> ThrowingEtwExceptionVerboseIsEnabled(EtwDiagnosticTrace trace)619 internal static bool ThrowingEtwExceptionVerboseIsEnabled(EtwDiagnosticTrace trace) 620 { 621 return TraceCore.IsEtwEventEnabled(trace, 19); 622 } 623 624 /// <summary> 625 /// Gets trace definition like: Throwing an exception. Source: {0}. Exception details: {1} 626 /// Event description ID=57409, Level=verbose, Channel=Analytic 627 /// </summary> 628 /// <param name="trace">The trace provider</param> 629 /// <param name="param0">Parameter 0 for event: Throwing an exception. Source: {0}. Exception details: {1}</param> 630 /// <param name="param1">Parameter 1 for event: Throwing an exception. Source: {0}. Exception details: {1}</param> 631 /// <param name="exception">Exception associated with the event</param> ThrowingEtwExceptionVerbose(EtwDiagnosticTrace trace, string param0, string param1, System.Exception exception)632 internal static void ThrowingEtwExceptionVerbose(EtwDiagnosticTrace trace, string param0, string param1, System.Exception exception) 633 { 634 TracePayload payload = trace.GetSerializedPayload(null, null, exception); 635 if (TraceCore.IsEtwEventEnabled(trace, 19)) 636 { 637 TraceCore.WriteEtwEvent(trace, 19, null, param0, param1, payload.SerializedException, payload.AppDomainFriendlyName); 638 } 639 } 640 641 /// <summary> 642 /// Check if trace definition is enabled 643 /// Event description ID=57407, Level=verbose, Channel=Analytic 644 /// </summary> 645 /// <param name="trace">The trace provider</param> ThrowingExceptionVerboseIsEnabled(EtwDiagnosticTrace trace)646 internal static bool ThrowingExceptionVerboseIsEnabled(EtwDiagnosticTrace trace) 647 { 648 return (trace.ShouldTrace(TraceEventLevel.Verbose) || TraceCore.IsEtwEventEnabled(trace, 20)); 649 } 650 651 /// <summary> 652 /// Gets trace definition like: Throwing an exception. Source: {0}. Exception details: {1} 653 /// Event description ID=57407, Level=verbose, Channel=Analytic 654 /// </summary> 655 /// <param name="trace">The trace provider</param> 656 /// <param name="param0">Parameter 0 for event: Throwing an exception. Source: {0}. Exception details: {1}</param> 657 /// <param name="param1">Parameter 1 for event: Throwing an exception. Source: {0}. Exception details: {1}</param> 658 /// <param name="exception">Exception associated with the event</param> ThrowingExceptionVerbose(EtwDiagnosticTrace trace, string param0, string param1, System.Exception exception)659 internal static void ThrowingExceptionVerbose(EtwDiagnosticTrace trace, string param0, string param1, System.Exception exception) 660 { 661 TracePayload payload = trace.GetSerializedPayload(null, null, exception); 662 if (TraceCore.IsEtwEventEnabled(trace, 20)) 663 { 664 TraceCore.WriteEtwEvent(trace, 20, null, param0, param1, payload.SerializedException, payload.AppDomainFriendlyName); 665 } 666 if (trace.ShouldTraceToTraceSource(TraceEventLevel.Verbose)) 667 { 668 string description = string.Format(Culture, ResourceManager.GetString("ThrowingExceptionVerbose", Culture), param0, param1); 669 TraceCore.WriteTraceSource(trace, 20, description, payload); 670 } 671 } 672 673 /// <summary> 674 /// Creates the event descriptors array 675 /// </summary> 676 // Critical = Sets the SecurityCritical member eventDescriptors 677 // Safe = We control what the event descriptors contain 678 [System.Security.SecuritySafeCriticalAttribute()] CreateEventDescriptors()679 static void CreateEventDescriptors() 680 { 681 eventDescriptors = new System.Runtime.Diagnostics.EventDescriptor[] { 682 new System.Runtime.Diagnostics.EventDescriptor(57393, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Informational, (byte)TraceEventOpcode.Info, 0x0, 0x1000000000010000), 683 new System.Runtime.Diagnostics.EventDescriptor(57394, 0, (byte)TraceChannel.Analytic, (byte)TraceEventLevel.Informational, (byte)TraceEventOpcode.Info, 0x0, 0x2000000000010000), 684 new System.Runtime.Diagnostics.EventDescriptor(57395, 0, (byte)TraceChannel.Analytic, (byte)TraceEventLevel.Error, (byte)TraceEventOpcode.Info, 0x0, 0x2000000000010000), 685 new System.Runtime.Diagnostics.EventDescriptor(57396, 0, (byte)TraceChannel.Analytic, (byte)TraceEventLevel.Warning, (byte)TraceEventOpcode.Info, 0x0, 0x2000000000010000), 686 new System.Runtime.Diagnostics.EventDescriptor(57397, 0, (byte)TraceChannel.Operational, (byte)TraceEventLevel.Critical, (byte)TraceEventOpcode.Info, 0x0, 0x4000000000010000), 687 new System.Runtime.Diagnostics.EventDescriptor(57399, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Critical, (byte)TraceEventOpcode.Info, 0x0, 0x1000000000010000), 688 new System.Runtime.Diagnostics.EventDescriptor(57400, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Error, (byte)TraceEventOpcode.Info, 0x0, 0x1000000000010000), 689 new System.Runtime.Diagnostics.EventDescriptor(57401, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Informational, (byte)TraceEventOpcode.Info, 0x0, 0x1000000000010000), 690 new System.Runtime.Diagnostics.EventDescriptor(57402, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Verbose, (byte)TraceEventOpcode.Info, 0x0, 0x1000000000010000), 691 new System.Runtime.Diagnostics.EventDescriptor(57403, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Warning, (byte)TraceEventOpcode.Info, 0x0, 0x1000000000010000), 692 new System.Runtime.Diagnostics.EventDescriptor(57404, 0, (byte)TraceChannel.Analytic, (byte)TraceEventLevel.Warning, (byte)TraceEventOpcode.Info, 0x0, 0x2000000000010000), 693 new System.Runtime.Diagnostics.EventDescriptor(131, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Verbose, (byte)12, 0x9cd, 0x1000000000010000), 694 new System.Runtime.Diagnostics.EventDescriptor(132, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Verbose, (byte)13, 0x9cd, 0x1000000000010000), 695 new System.Runtime.Diagnostics.EventDescriptor(133, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Verbose, (byte)TraceEventOpcode.Start, 0xa21, 0x1000000000200000), 696 new System.Runtime.Diagnostics.EventDescriptor(134, 0, (byte)TraceChannel.Debug, (byte)TraceEventLevel.Verbose, (byte)TraceEventOpcode.Stop, 0xa21, 0x1000000000200000), 697 new System.Runtime.Diagnostics.EventDescriptor(57405, 0, (byte)TraceChannel.Operational, (byte)TraceEventLevel.Error, (byte)TraceEventOpcode.Info, 0x0, 0x4000000000010000), 698 new System.Runtime.Diagnostics.EventDescriptor(57406, 0, (byte)TraceChannel.Analytic, (byte)TraceEventLevel.Verbose, (byte)TraceEventOpcode.Info, 0x0, 0x2000000000010000), 699 new System.Runtime.Diagnostics.EventDescriptor(57408, 0, (byte)TraceChannel.Operational, (byte)TraceEventLevel.Critical, (byte)TraceEventOpcode.Info, 0x0, 0x4000000000010000), 700 new System.Runtime.Diagnostics.EventDescriptor(57410, 0, (byte)TraceChannel.Analytic, (byte)TraceEventLevel.Warning, (byte)TraceEventOpcode.Info, 0x0, 0x2000000000010000), 701 new System.Runtime.Diagnostics.EventDescriptor(57409, 0, (byte)TraceChannel.Analytic, (byte)TraceEventLevel.Verbose, (byte)TraceEventOpcode.Info, 0x0, 0x2000000000010000), 702 new System.Runtime.Diagnostics.EventDescriptor(57407, 0, (byte)TraceChannel.Analytic, (byte)TraceEventLevel.Verbose, (byte)TraceEventOpcode.Info, 0x0, 0x2000000000010000)}; 703 } 704 705 /// <summary> 706 /// Ensures that the event descriptors array is initialized 707 /// </summary> EnsureEventDescriptors()708 static void EnsureEventDescriptors() 709 { 710 if (eventDescriptorsCreated) 711 { 712 return; 713 } 714 System.Threading.Monitor.Enter(syncLock); 715 try 716 { 717 if (eventDescriptorsCreated) 718 { 719 return; 720 } 721 CreateEventDescriptors(); 722 eventDescriptorsCreated = true; 723 } 724 finally 725 { 726 System.Threading.Monitor.Exit(syncLock); 727 } 728 } 729 730 /// <summary> 731 /// Check if ETW tracing is enabled for the particular event 732 /// </summary> 733 /// <param name="trace">The trace provider</param> 734 /// <param name="eventIndex">The index of the event descriptor</param> 735 // Critical = Accesses SecurityCritical member eventDescriptors 736 // Safe = eventDescriptors is not changed 737 [System.Security.SecuritySafeCriticalAttribute()] IsEtwEventEnabled(EtwDiagnosticTrace trace, int eventIndex)738 static bool IsEtwEventEnabled(EtwDiagnosticTrace trace, int eventIndex) 739 { 740 if (trace.IsEtwProviderEnabled) 741 { 742 EnsureEventDescriptors(); 743 return trace.IsEtwEventEnabled(ref eventDescriptors[eventIndex], false); 744 } 745 return false; 746 } 747 748 /// <summary> 749 /// Writes ETW trace event 750 ///</summary> 751 /// <param name="trace">The trace provider</param> 752 /// <param name="eventIndex">The index of the event descriptor</param>> 753 /// <param name="eventParam0">A parameter of the ETW event</param>> 754 /// <param name="eventParam1">A parameter of the ETW event</param>> 755 /// <param name="eventParam2">A parameter of the ETW event</param>> 756 /// <param name="eventParam3">A parameter of the ETW event</param>> 757 /// <param name="eventParam4">A parameter of the ETW event</param>> 758 // Critical = Calls SecurityCritical method EtwProvider.WriteEvent 759 // Safe = We only allow setting of provider id from SecurityCritical code, access to EventDescriptors is SecurityCritical, and ETW limits buffer sizes. 760 [System.Security.SecuritySafeCriticalAttribute()] WriteEtwEvent(EtwDiagnosticTrace trace, int eventIndex, System.Runtime.Diagnostics.EventTraceActivity eventParam0, string eventParam1, string eventParam2, string eventParam3, string eventParam4)761 static bool WriteEtwEvent(EtwDiagnosticTrace trace, int eventIndex, System.Runtime.Diagnostics.EventTraceActivity eventParam0, string eventParam1, string eventParam2, string eventParam3, string eventParam4) 762 { 763 EnsureEventDescriptors(); 764 return trace.EtwProvider.WriteEvent(ref eventDescriptors[eventIndex], eventParam0, eventParam1, eventParam2, eventParam3, eventParam4); 765 } 766 767 /// <summary> 768 /// Writes ETW trace event 769 ///</summary> 770 /// <param name="trace">The trace provider</param> 771 /// <param name="eventIndex">The index of the event descriptor</param>> 772 /// <param name="eventParam0">A parameter of the ETW event</param>> 773 /// <param name="eventParam1">A parameter of the ETW event</param>> 774 /// <param name="eventParam2">A parameter of the ETW event</param>> 775 /// <param name="eventParam3">A parameter of the ETW event</param>> 776 // Critical = Calls SecurityCritical method EtwProvider.WriteEvent 777 // Safe = We only allow setting of provider id from SecurityCritical code, access to EventDescriptors is SecurityCritical, and ETW limits buffer sizes. 778 [System.Security.SecuritySafeCriticalAttribute()] WriteEtwEvent(EtwDiagnosticTrace trace, int eventIndex, System.Runtime.Diagnostics.EventTraceActivity eventParam0, string eventParam1, string eventParam2, string eventParam3)779 static bool WriteEtwEvent(EtwDiagnosticTrace trace, int eventIndex, System.Runtime.Diagnostics.EventTraceActivity eventParam0, string eventParam1, string eventParam2, string eventParam3) 780 { 781 EnsureEventDescriptors(); 782 return trace.EtwProvider.WriteEvent(ref eventDescriptors[eventIndex], eventParam0, eventParam1, eventParam2, eventParam3); 783 } 784 785 /// <summary> 786 /// Writes ETW trace event 787 ///</summary> 788 /// <param name="trace">The trace provider</param> 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()] WriteEtwEvent(EtwDiagnosticTrace trace, int eventIndex, System.Runtime.Diagnostics.EventTraceActivity eventParam0, string eventParam1, string eventParam2)796 static bool WriteEtwEvent(EtwDiagnosticTrace trace, int eventIndex, System.Runtime.Diagnostics.EventTraceActivity eventParam0, string eventParam1, string eventParam2) 797 { 798 EnsureEventDescriptors(); 799 return trace.EtwProvider.WriteEvent(ref eventDescriptors[eventIndex], eventParam0, eventParam1, eventParam2); 800 } 801 802 /// <summary> 803 /// Writes ETW trace event 804 ///</summary> 805 /// <param name="trace">The trace provider</param> 806 /// <param name="eventIndex">The index of the event descriptor</param>> 807 /// <param name="eventParam0">A parameter of the ETW event</param>> 808 /// <param name="eventParam1">A parameter of the ETW event</param>> 809 /// <param name="eventParam2">A parameter of the ETW event</param>> 810 // Critical = Calls SecurityCritical method EtwProvider.WriteEvent 811 // Safe = We only allow setting of provider id from SecurityCritical code, access to EventDescriptors is SecurityCritical, and ETW limits buffer sizes. 812 [System.Security.SecuritySafeCriticalAttribute()] WriteEtwEvent(EtwDiagnosticTrace trace, int eventIndex, System.Runtime.Diagnostics.EventTraceActivity eventParam0, int eventParam1, string eventParam2)813 static bool WriteEtwEvent(EtwDiagnosticTrace trace, int eventIndex, System.Runtime.Diagnostics.EventTraceActivity eventParam0, int eventParam1, string eventParam2) 814 { 815 EnsureEventDescriptors(); 816 return trace.EtwProvider.WriteEvent(ref eventDescriptors[eventIndex], eventParam0, eventParam1, eventParam2); 817 } 818 819 /// <summary> 820 /// Writes ETW trace event 821 ///</summary> 822 /// <param name="trace">The trace provider</param> 823 /// <param name="eventIndex">The index of the event descriptor</param>> 824 /// <param name="eventParam0">A parameter of the ETW event</param>> 825 /// <param name="eventParam1">A parameter of the ETW event</param>> 826 /// <param name="eventParam2">A parameter of the ETW event</param>> 827 /// <param name="eventParam3">A parameter of the ETW event</param>> 828 // Critical = Calls SecurityCritical method EtwProvider.WriteEvent 829 // Safe = We only allow setting of provider id from SecurityCritical code, access to EventDescriptors is SecurityCritical, and ETW limits buffer sizes. 830 [System.Security.SecuritySafeCriticalAttribute()] WriteEtwEvent(EtwDiagnosticTrace trace, int eventIndex, System.Runtime.Diagnostics.EventTraceActivity eventParam0, int eventParam1, int eventParam2, string eventParam3)831 static bool WriteEtwEvent(EtwDiagnosticTrace trace, int eventIndex, System.Runtime.Diagnostics.EventTraceActivity eventParam0, int eventParam1, int eventParam2, string eventParam3) 832 { 833 EnsureEventDescriptors(); 834 return trace.EtwProvider.WriteEvent(ref eventDescriptors[eventIndex], eventParam0, eventParam1, eventParam2, eventParam3); 835 } 836 837 /// <summary> 838 /// Writes ETW trace event 839 ///</summary> 840 /// <param name="trace">The trace provider</param> 841 /// <param name="eventIndex">The index of the event descriptor</param>> 842 /// <param name="eventParam0">A parameter of the ETW event</param>> 843 /// <param name="eventParam1">A parameter of the ETW event</param>> 844 // Critical = Calls SecurityCritical method EtwProvider.WriteEvent 845 // Safe = We only allow setting of provider id from SecurityCritical code, access to EventDescriptors is SecurityCritical, and ETW limits buffer sizes. 846 [System.Security.SecuritySafeCriticalAttribute()] WriteEtwEvent(EtwDiagnosticTrace trace, int eventIndex, System.Runtime.Diagnostics.EventTraceActivity eventParam0, string eventParam1)847 static bool WriteEtwEvent(EtwDiagnosticTrace trace, int eventIndex, System.Runtime.Diagnostics.EventTraceActivity eventParam0, string eventParam1) 848 { 849 EnsureEventDescriptors(); 850 return trace.EtwProvider.WriteEvent(ref eventDescriptors[eventIndex], eventParam0, eventParam1); 851 } 852 853 /// <summary> 854 /// write a trace source into the diagnostic trace 855 /// </summary> 856 /// <param name="trace">The trace provider</param> 857 /// <param name="eventIndex">The index of the event descriptor</param> 858 /// <param name="description">The description to write</param> 859 /// <param name="payload">The trace payload</param> 860 // Critical = Calls SecurityCritical method EtwDiagnosticTrace.WriteTraceSource 861 // Safe = We only allow setting of provider id from SecurityCritical code 862 [System.Security.SecuritySafeCriticalAttribute()] WriteTraceSource(EtwDiagnosticTrace trace, int eventIndex, string description, TracePayload payload)863 static void WriteTraceSource(EtwDiagnosticTrace trace, int eventIndex, string description, TracePayload payload) 864 { 865 EnsureEventDescriptors(); 866 trace.WriteTraceSource(ref eventDescriptors[eventIndex], description, payload); 867 } 868 } 869 } 870 871