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