From 10bfa33b52e9c092b5d127e50a05cba201a638f0 Mon Sep 17 00:00:00 2001 From: Stephen Toub Date: Mon, 22 Jul 2024 08:48:45 -0400 Subject: [PATCH 1/3] Delete dead code in System.Diagnostics.Tracing tests --- .../EventSourceTestParser.cs | 2681 ----------------- .../BasicEventSourceTest/FuzzyTests.Etw.cs | 4 - .../tests/BasicEventSourceTest/FuzzyTests.cs | 4 - .../Harness/EtwListener.cs | 4 - .../Harness/EventTestHarness.cs | 8 +- .../BasicEventSourceTest/Harness/Listeners.cs | 7 - .../BasicEventSourceTest/LoudListener.cs | 4 - .../BasicEventSourceTest/TestCallbacks.cs | 8 +- .../BasicEventSourceTest/TestEventCounter.cs | 8 +- .../tests/BasicEventSourceTest/TestFilter.cs | 6 - .../BasicEventSourceTest/TestNotSupported.cs | 10 +- .../BasicEventSourceTest/TestShutdown.cs | 112 - .../BasicEventSourceTest/TestUtilities.cs | 7 +- .../TestsEventSourceLifetime.cs | 10 +- .../TestsManifestGeneration.Etw.cs | 7 - .../TestsManifestGeneration.cs | 14 +- .../TestsManifestNegative.cs | 11 +- .../tests/BasicEventSourceTest/TestsTraits.cs | 5 - .../BasicEventSourceTest/TestsUserErrors.cs | 71 +- .../tests/BasicEventSourceTest/TestsWrite.cs | 6 +- .../BasicEventSourceTest/TestsWriteEvent.cs | 8 +- .../TestsWriteEventToListener.Etw.cs | 5 - .../TestsWriteEventToListener.cs | 9 +- .../CustomEventSources/EventSourceTest.cs | 9 +- .../InvalidCallsToWriteEvent.cs | 8 - .../CustomEventSources/InvalidEventSources.cs | 8 - .../CustomEventSources/SimpleEventSource.cs | 15 +- .../UseAbstractEventSource.cs | 8 - .../UseInterfaceEventSource.cs | 9 - .../System.Diagnostics.Tracing.Tests.csproj | 2 - .../tracing/eventcounter/eventcounter.cs | 6 +- src/tests/tracing/eventcounter/gh53564.cs | 8 +- .../eventcounter/incrementingeventcounter.cs | 6 +- .../incrementingpollingcounter.cs | 6 +- .../tracing/eventcounter/pollingcounter.cs | 6 +- .../tracing/eventcounter/regression-25709.cs | 8 +- .../tracing/eventcounter/regression-46938.cs | 8 +- .../tracing/eventcounter/runtimecounters.cs | 8 +- .../RuntimeEventSourceTest.cs | 10 +- 39 files changed, 38 insertions(+), 3096 deletions(-) delete mode 100644 src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/EventSourceTestParser.cs delete mode 100644 src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestShutdown.cs diff --git a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/EventSourceTestParser.cs b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/EventSourceTestParser.cs deleted file mode 100644 index 4229ebf40d0ff..0000000000000 --- a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/EventSourceTestParser.cs +++ /dev/null @@ -1,2681 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System; -using System.Diagnostics; -#if USE_MDT_EVENTSOURCE -using Microsoft.Diagnostics.Tracing; -#else -using System.Diagnostics.Tracing; -#endif -using System.Text; -using Address = System.UInt64; - -#pragma warning disable 1591 // disable warnings on XML comments not being present - -// This code was automatically generated by the TraceParserGen tool, which converts -// an ETW event manifest into strongly typed C# classes. -//namespace Microsoft.Diagnostics.Tracing.Parsers -//{ -// using Microsoft.Diagnostics.Tracing.Parsers.EventSourceTest; - -// [System.CodeDom.Compiler.GeneratedCode("traceparsergen", "2.0")] -// public sealed class EventSourceTestTraceEventParser : TraceEventParser -// { -// public static string ProviderName = "EventSourceTest"; -// public static Guid ProviderGuid = new Guid(unchecked((int)0x69e2aa3e), unchecked((short)0x083b), unchecked((short)0x5014), 0xca, 0xd4, 0x3e, 0x51, 0x1a, 0x0b, 0x94, 0xcf); -// public enum Keywords : long -// { -// Hasnoargs = 0x1, -// Hasintargs = 0x2, -// Haslongargs = 0x4, -// Hasstringargs = 0x8, -// Hasdatetimeargs = 0x10, -// Hasenumargs = 0x20, -// Transfer = 0x40, -// Session3 = 0x100000000000, -// Session2 = 0x200000000000, -// Session1 = 0x400000000000, -// Session0 = 0x800000000000, -// }; - -// public EventSourceTestTraceEventParser(TraceEventSource source) : base(source) { } - -// public event Action Event0 -// { -// add -// { -// source.RegisterEventTemplate(Event0Template(value)); -// } -// remove -// { -// source.UnregisterEventTemplate(value, 1, ProviderGuid); -// } -// } -// public event Action EventEnum -// { -// add -// { -// source.RegisterEventTemplate(EventEnumTemplate(value)); -// } -// remove -// { -// source.UnregisterEventTemplate(value, 19, ProviderGuid); -// } -// } -// public event Action EventEnum1 -// { -// add -// { -// source.RegisterEventTemplate(EventEnum1Template(value)); -// } -// remove -// { -// source.UnregisterEventTemplate(value, 20, ProviderGuid); -// } -// } -// public event Action EventFlags -// { -// add -// { -// source.RegisterEventTemplate(EventFlagsTemplate(value)); -// } -// remove -// { -// source.UnregisterEventTemplate(value, 21, ProviderGuid); -// } -// } -// public event Action EventFlags1 -// { -// add -// { -// source.RegisterEventTemplate(EventFlags1Template(value)); -// } -// remove -// { -// source.UnregisterEventTemplate(value, 22, ProviderGuid); -// } -// } -// public event Action EventI -// { -// add -// { -// source.RegisterEventTemplate(EventITemplate(value)); -// } -// remove -// { -// source.UnregisterEventTemplate(value, 2, ProviderGuid); -// } -// } -// public event Action EventII -// { -// add -// { -// source.RegisterEventTemplate(EventIITemplate(value)); -// } -// remove -// { -// source.UnregisterEventTemplate(value, 3, ProviderGuid); -// } -// } -// public event Action EventIII -// { -// add -// { -// source.RegisterEventTemplate(EventIIITemplate(value)); -// } -// remove -// { -// source.UnregisterEventTemplate(value, 4, ProviderGuid); -// } -// } -// public event Action EventL -// { -// add -// { -// source.RegisterEventTemplate(EventLTemplate(value)); -// } -// remove -// { -// source.UnregisterEventTemplate(value, 5, ProviderGuid); -// } -// } -// public event Action EventLL -// { -// add -// { -// source.RegisterEventTemplate(EventLLTemplate(value)); -// } -// remove -// { -// source.UnregisterEventTemplate(value, 6, ProviderGuid); -// } -// } -// public event Action EventLLL -// { -// add -// { -// source.RegisterEventTemplate(EventLLLTemplate(value)); -// } -// remove -// { -// source.UnregisterEventTemplate(value, 7, ProviderGuid); -// } -// } -// public event Action EventNoAttributes -// { -// add -// { -// source.RegisterEventTemplate(EventNoAttributesTemplate(value)); -// } -// remove -// { -// source.UnregisterEventTemplate(value, 16, ProviderGuid); -// } -// } -// public event Action EventS -// { -// add -// { -// source.RegisterEventTemplate(EventSTemplate(value)); -// } -// remove -// { -// source.UnregisterEventTemplate(value, 8, ProviderGuid); -// } -// } -// public event Action EventSI -// { -// add -// { -// source.RegisterEventTemplate(EventSITemplate(value)); -// } -// remove -// { -// source.UnregisterEventTemplate(value, 11, ProviderGuid); -// } -// } -// public event Action EventSII -// { -// add -// { -// source.RegisterEventTemplate(EventSIITemplate(value)); -// } -// remove -// { -// source.UnregisterEventTemplate(value, 13, ProviderGuid); -// } -// } -// public event Action EventSL -// { -// add -// { -// source.RegisterEventTemplate(EventSLTemplate(value)); -// } -// remove -// { -// source.UnregisterEventTemplate(value, 12, ProviderGuid); -// } -// } -// public event Action EventSS -// { -// add -// { -// source.RegisterEventTemplate(EventSSTemplate(value)); -// } -// remove -// { -// source.UnregisterEventTemplate(value, 9, ProviderGuid); -// } -// } -// public event Action EventSSS -// { -// add -// { -// source.RegisterEventTemplate(EventSSSTemplate(value)); -// } -// remove -// { -// source.UnregisterEventTemplate(value, 10, ProviderGuid); -// } -// } -// public event Action EventWith7Strings -// { -// add -// { -// source.RegisterEventTemplate(EventWith7StringsTemplate(value)); -// } -// remove -// { -// source.UnregisterEventTemplate(value, 26, ProviderGuid); -// } -// } -// public event Action EventWith9Strings -// { -// add -// { -// source.RegisterEventTemplate(EventWith9StringsTemplate(value)); -// } -// remove -// { -// source.UnregisterEventTemplate(value, 27, ProviderGuid); -// } -// } -// public event Action EventWithByteArrArg -// { -// add -// { -// source.RegisterEventTemplate(EventWithByteArrArgTemplate(value)); -// } -// remove -// { -// source.UnregisterEventTemplate(value, 34, ProviderGuid); -// } -// } -// public event Action EventWithBytePtrArg -// { -// add -// { -// source.RegisterEventTemplate(EventWithBytePtrArgTemplate(value)); -// } -// remove -// { -// source.UnregisterEventTemplate(value, 35, ProviderGuid); -// } -// } -// public event Action EventWithEscapingMessage -// { -// add -// { -// source.RegisterEventTemplate(EventWithEscapingMessageTemplate(value)); -// } -// remove -// { -// source.UnregisterEventTemplate(value, 32, ProviderGuid); -// } -// } -// public event Action EventWithManyTypeArgs -// { -// add -// { -// source.RegisterEventTemplate(EventWithManyTypeArgsTemplate(value)); -// } -// remove -// { -// source.UnregisterEventTemplate(value, 25, ProviderGuid); -// } -// } -// public event Action EventWithMoreEscapingMessage -// { -// add -// { -// source.RegisterEventTemplate(EventWithMoreEscapingMessageTemplate(value)); -// } -// remove -// { -// source.UnregisterEventTemplate(value, 33, ProviderGuid); -// } -// } -// public event Action EventWithWeirdArgs -// { -// add -// { -// source.RegisterEventTemplate(EventWithWeirdArgsTemplate(value)); -// } -// remove -// { -// source.UnregisterEventTemplate(value, 30, ProviderGuid); -// } -// } -// public event Action Message -// { -// add -// { -// source.RegisterEventTemplate(MessageTemplate(value)); -// } -// remove -// { -// source.UnregisterEventTemplate(value, 14, ProviderGuid); -// } -// } -// public event Action SlowerHelper -// { -// add -// { -// source.RegisterEventTemplate(SlowerHelperTemplate(value)); -// } -// remove -// { -// source.UnregisterEventTemplate(value, 18, ProviderGuid); -// } -// } -// public event Action WorkDateTimeOpcode1 -// { -// add -// { -// source.RegisterEventTemplate(WorkDateTimeOpcode1Template(value)); -// } -// remove -// { -// source.UnregisterEventTemplate(value, 24, ProviderGuid); -// } -// } -// public event Action WorkItem -// { -// add -// { -// source.RegisterEventTemplate(WorkItemTemplate(value)); -// } -// remove -// { -// source.UnregisterEventTemplate(value, 15, ProviderGuid); -// } -// } -// public event Action WorkItemBadSend -// { -// add -// { -// source.RegisterEventTemplate(WorkItemBadSendTemplate(value)); -// } -// remove -// { -// source.UnregisterEventTemplate(value, 23, ProviderGuid); -// } -// } -// public event Action WorkItemSend -// { -// add -// { -// source.RegisterEventTemplate(WorkItemSendTemplate(value)); -// } -// remove -// { -// source.UnregisterEventTemplate(value, 17, ProviderGuid); -// } -// } -// public event Action WorkManyArgsSend -// { -// add -// { -// source.RegisterEventTemplate(WorkManyArgsSendTemplate(value)); -// } -// remove -// { -// source.UnregisterEventTemplate(value, 29, ProviderGuid); -// } -// } -// public event Action WorkWeirdArgsSend -// { -// add -// { -// source.RegisterEventTemplate(WorkWeirdArgsSendTemplate(value)); -// } -// remove -// { -// source.UnregisterEventTemplate(value, 31, ProviderGuid); -// } -// } - -// #region private -// protected override string GetProviderName() { return ProviderName; } - -// private static EmptyTraceData Event0Template(Action action) -// { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName -// return new EmptyTraceData(action, 1, 65533, "Event0", Guid.Empty, 0, "", ProviderGuid, ProviderName); -// } -// private static EventEnumArgs EventEnumTemplate(Action action) -// { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName -// return new EventEnumArgs(action, 19, 65515, "EventEnum", Guid.Empty, 0, "", ProviderGuid, ProviderName); -// } -// private static EventEnum1Args EventEnum1Template(Action action) -// { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName -// return new EventEnum1Args(action, 20, 65514, "EventEnum1", Guid.Empty, 0, "", ProviderGuid, ProviderName); -// } -// private static EventFlagsArgs EventFlagsTemplate(Action action) -// { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName -// return new EventFlagsArgs(action, 21, 65513, "EventFlags", Guid.Empty, 0, "", ProviderGuid, ProviderName); -// } -// private static EventFlags1Args EventFlags1Template(Action action) -// { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName -// return new EventFlags1Args(action, 22, 65512, "EventFlags1", Guid.Empty, 0, "", ProviderGuid, ProviderName); -// } -// private static EventIArgs EventITemplate(Action action) -// { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName -// return new EventIArgs(action, 2, 65532, "EventI", Guid.Empty, 0, "", ProviderGuid, ProviderName); -// } -// private static EventIIArgs EventIITemplate(Action action) -// { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName -// return new EventIIArgs(action, 3, 65531, "EventII", Guid.Empty, 0, "", ProviderGuid, ProviderName); -// } -// private static EventIIIArgs EventIIITemplate(Action action) -// { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName -// return new EventIIIArgs(action, 4, 65530, "EventIII", Guid.Empty, 0, "", ProviderGuid, ProviderName); -// } -// private static EventLArgs EventLTemplate(Action action) -// { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName -// return new EventLArgs(action, 5, 65529, "EventL", Guid.Empty, 0, "", ProviderGuid, ProviderName); -// } -// private static EventLLArgs EventLLTemplate(Action action) -// { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName -// return new EventLLArgs(action, 6, 65528, "EventLL", Guid.Empty, 0, "", ProviderGuid, ProviderName); -// } -// private static EventLLLArgs EventLLLTemplate(Action action) -// { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName -// return new EventLLLArgs(action, 7, 65527, "EventLLL", Guid.Empty, 0, "", ProviderGuid, ProviderName); -// } -// private static EventNoAttributesArgs EventNoAttributesTemplate(Action action) -// { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName -// return new EventNoAttributesArgs(action, 16, 65518, "EventNoAttributes", Guid.Empty, 0, "", ProviderGuid, ProviderName); -// } -// private static EventSArgs EventSTemplate(Action action) -// { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName -// return new EventSArgs(action, 8, 65526, "EventS", Guid.Empty, 0, "", ProviderGuid, ProviderName); -// } -// private static EventSIArgs EventSITemplate(Action action) -// { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName -// return new EventSIArgs(action, 11, 65523, "EventSI", Guid.Empty, 0, "", ProviderGuid, ProviderName); -// } -// private static EventSIIArgs EventSIITemplate(Action action) -// { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName -// return new EventSIIArgs(action, 13, 65521, "EventSII", Guid.Empty, 0, "", ProviderGuid, ProviderName); -// } -// private static EventSLArgs EventSLTemplate(Action action) -// { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName -// return new EventSLArgs(action, 12, 65522, "EventSL", Guid.Empty, 0, "", ProviderGuid, ProviderName); -// } -// private static EventSSArgs EventSSTemplate(Action action) -// { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName -// return new EventSSArgs(action, 9, 65525, "EventSS", Guid.Empty, 0, "", ProviderGuid, ProviderName); -// } -// private static EventSSSArgs EventSSSTemplate(Action action) -// { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName -// return new EventSSSArgs(action, 10, 65524, "EventSSS", Guid.Empty, 0, "", ProviderGuid, ProviderName); -// } -// private static EventWith7StringsArgs EventWith7StringsTemplate(Action action) -// { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName -// return new EventWith7StringsArgs(action, 26, 65508, "EventWith7Strings", Guid.Empty, 0, "", ProviderGuid, ProviderName); -// } -// private static EventWith9StringsArgs EventWith9StringsTemplate(Action action) -// { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName -// return new EventWith9StringsArgs(action, 27, 65507, "EventWith9Strings", Guid.Empty, 0, "", ProviderGuid, ProviderName); -// } -// private static EventWithByteArrArgArgs EventWithByteArrArgTemplate(Action action) -// { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName -// return new EventWithByteArrArgArgs(action, 34, 65500, "EventWithByteArrArg", Guid.Empty, 0, "", ProviderGuid, ProviderName); -// } -// private static EventWithBytePtrArgArgs EventWithBytePtrArgTemplate(Action action) -// { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName -// return new EventWithBytePtrArgArgs(action, 35, 65499, "EventWithBytePtrArg", Guid.Empty, 0, "", ProviderGuid, ProviderName); -// } -// private static EventWithEscapingMessageArgs EventWithEscapingMessageTemplate(Action action) -// { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName -// return new EventWithEscapingMessageArgs(action, 32, 65502, "EventWithEscapingMessage", Guid.Empty, 0, "", ProviderGuid, ProviderName); -// } -// private static EventWithManyTypeArgsArgs EventWithManyTypeArgsTemplate(Action action) -// { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName -// return new EventWithManyTypeArgsArgs(action, 25, 65509, "EventWithManyTypeArgs", Guid.Empty, 0, "", ProviderGuid, ProviderName); -// } -// private static EventWithMoreEscapingMessageArgs EventWithMoreEscapingMessageTemplate(Action action) -// { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName -// return new EventWithMoreEscapingMessageArgs(action, 33, 65501, "EventWithMoreEscapingMessage", Guid.Empty, 0, "", ProviderGuid, ProviderName); -// } -// private static EventWithWeirdArgsArgs EventWithWeirdArgsTemplate(Action action) -// { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName -// return new EventWithWeirdArgsArgs(action, 30, 65504, "EventWithWeirdArgs", Guid.Empty, 0, "", ProviderGuid, ProviderName); -// } -// private static MessageArgs MessageTemplate(Action action) -// { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName -// return new MessageArgs(action, 14, 65520, "Message", Guid.Empty, 0, "", ProviderGuid, ProviderName); -// } -// private static SlowerHelperArgs SlowerHelperTemplate(Action action) -// { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName -// return new SlowerHelperArgs(action, 18, 65516, "SlowerHelper", Guid.Empty, 0, "", ProviderGuid, ProviderName); -// } -// private static EventDateTimeArgs WorkDateTimeOpcode1Template(Action action) -// { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName -// return new EventDateTimeArgs(action, 24, 5, "WorkDateTime", Guid.Empty, 11, "Opcode1", ProviderGuid, ProviderName); -// } -// private static EmptyTraceData WorkItemTemplate(Action action) -// { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName -// return new EmptyTraceData(action, 15, 1, "WorkItem", Guid.Empty, 0, "", ProviderGuid, ProviderName); -// } -// private static LogTaskScheduledBadArgs WorkItemBadSendTemplate(Action action) -// { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName -// return new LogTaskScheduledBadArgs(action, 23, 2, "WorkItemBad", Guid.Empty, 9, "Send", ProviderGuid, ProviderName); -// } -// private static LogTaskScheduledArgs WorkItemSendTemplate(Action action) -// { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName -// return new LogTaskScheduledArgs(action, 17, 1, "WorkItem", Guid.Empty, 9, "Send", ProviderGuid, ProviderName); -// } -// private static EventWithXferManyTypeArgsArgs WorkManyArgsSendTemplate(Action action) -// { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName -// return new EventWithXferManyTypeArgsArgs(action, 29, 3, "WorkManyArgs", Guid.Empty, 9, "Send", ProviderGuid, ProviderName); -// } -// private static EventWithXferWeirdArgsArgs WorkWeirdArgsSendTemplate(Action action) -// { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName -// return new EventWithXferWeirdArgsArgs(action, 31, 4, "WorkWeirdArgs", Guid.Empty, 9, "Send", ProviderGuid, ProviderName); -// } - -// private static volatile TraceEvent[] s_templates; -// protected override void EnumerateTemplates(Func eventsToObserve, Action callback) -// { -// if (s_templates == null) -// { -// var templates = new TraceEvent[34]; -// templates[0] = Event0Template(null); -// templates[1] = EventITemplate(null); -// templates[2] = EventIITemplate(null); -// templates[3] = EventIIITemplate(null); -// templates[4] = EventLTemplate(null); -// templates[5] = EventLLTemplate(null); -// templates[6] = EventLLLTemplate(null); -// templates[7] = EventSTemplate(null); -// templates[8] = EventSSTemplate(null); -// templates[9] = EventSSSTemplate(null); -// templates[10] = EventSITemplate(null); -// templates[11] = EventSLTemplate(null); -// templates[12] = EventSIITemplate(null); -// templates[13] = MessageTemplate(null); -// templates[14] = WorkItemTemplate(null); -// templates[15] = EventNoAttributesTemplate(null); -// templates[16] = WorkItemSendTemplate(null); -// templates[17] = SlowerHelperTemplate(null); -// templates[18] = EventEnumTemplate(null); -// templates[19] = EventEnum1Template(null); -// templates[20] = EventFlagsTemplate(null); -// templates[21] = EventFlags1Template(null); -// templates[22] = WorkItemBadSendTemplate(null); -// templates[23] = WorkDateTimeOpcode1Template(null); -// templates[24] = EventWithManyTypeArgsTemplate(null); -// templates[25] = EventWith7StringsTemplate(null); -// templates[26] = EventWith9StringsTemplate(null); -// templates[27] = WorkManyArgsSendTemplate(null); -// templates[28] = EventWithWeirdArgsTemplate(null); -// templates[29] = WorkWeirdArgsSendTemplate(null); -// templates[30] = EventWithEscapingMessageTemplate(null); -// templates[31] = EventWithMoreEscapingMessageTemplate(null); -// templates[32] = EventWithByteArrArgTemplate(null); -// templates[33] = EventWithBytePtrArgTemplate(null); -// s_templates = templates; -// } -// foreach (var template in s_templates) -// if (eventsToObserve == null || eventsToObserve(template.ProviderName, template.EventName) == EventFilterResponse.AcceptEvent) -// callback(template); -// } - -// #endregion -// } -//} - -//namespace Microsoft.Diagnostics.Tracing.Parsers.EventSourceTest -//{ -// public sealed class EventEnumArgs : TraceEvent -// { -// public MyColor x { get { return (MyColor)GetInt32At(0); } } - -// #region Private -// internal EventEnumArgs(Action target, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) -// : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) -// { -// this.m_target = target; -// } -// protected override void Dispatch() -// { -// m_target(this); -// } -// protected override void Validate() -// { -// Debug.Assert(!(Version == 0 && EventDataLength != 4)); -// Debug.Assert(!(Version > 0 && EventDataLength < 4)); -// } -// protected override Delegate Target -// { -// get { return m_target; } -// set { m_target = (Action)value; } -// } -// public override StringBuilder ToXml(StringBuilder sb) -// { -// Prefix(sb); -// XmlAttrib(sb, "x", x); -// sb.Append("/>"); -// return sb; -// } - -// public override string[] PayloadNames -// { -// get -// { -// if (payloadNames == null) -// payloadNames = new string[] { "x" }; -// return payloadNames; -// } -// } - -// public override object PayloadValue(int index) -// { -// switch (index) -// { -// case 0: -// return x; -// default: -// Debug.Fail("Bad field index"); -// return null; -// } -// } - -// private event Action m_target; -// #endregion -// } -// public sealed class EventEnum1Args : TraceEvent -// { -// public MyColor x { get { return (MyColor)GetInt32At(0); } } - -// #region Private -// internal EventEnum1Args(Action target, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) -// : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) -// { -// this.m_target = target; -// } -// protected override void Dispatch() -// { -// m_target(this); -// } -// protected override void Validate() -// { -// Debug.Assert(!(Version == 0 && EventDataLength != 4)); -// Debug.Assert(!(Version > 0 && EventDataLength < 4)); -// } -// protected override Delegate Target -// { -// get { return m_target; } -// set { m_target = (Action)value; } -// } -// public override StringBuilder ToXml(StringBuilder sb) -// { -// Prefix(sb); -// XmlAttrib(sb, "x", x); -// sb.Append("/>"); -// return sb; -// } - -// public override string[] PayloadNames -// { -// get -// { -// if (payloadNames == null) -// payloadNames = new string[] { "x" }; -// return payloadNames; -// } -// } - -// public override object PayloadValue(int index) -// { -// switch (index) -// { -// case 0: -// return x; -// default: -// Debug.Fail("Bad field index"); -// return null; -// } -// } - -// private event Action m_target; -// #endregion -// } -// public sealed class EventFlagsArgs : TraceEvent -// { -// public MyFlags x { get { return (MyFlags)GetInt32At(0); } } - -// #region Private -// internal EventFlagsArgs(Action target, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) -// : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) -// { -// this.m_target = target; -// } -// protected override void Dispatch() -// { -// m_target(this); -// } -// protected override void Validate() -// { -// Debug.Assert(!(Version == 0 && EventDataLength != 4)); -// Debug.Assert(!(Version > 0 && EventDataLength < 4)); -// } -// protected override Delegate Target -// { -// get { return m_target; } -// set { m_target = (Action)value; } -// } -// public override StringBuilder ToXml(StringBuilder sb) -// { -// Prefix(sb); -// XmlAttrib(sb, "x", x); -// sb.Append("/>"); -// return sb; -// } - -// public override string[] PayloadNames -// { -// get -// { -// if (payloadNames == null) -// payloadNames = new string[] { "x" }; -// return payloadNames; -// } -// } - -// public override object PayloadValue(int index) -// { -// switch (index) -// { -// case 0: -// return x; -// default: -// Debug.Fail("Bad field index"); -// return null; -// } -// } - -// private event Action m_target; -// #endregion -// } -// public sealed class EventFlags1Args : TraceEvent -// { -// public MyFlags x { get { return (MyFlags)GetInt32At(0); } } - -// #region Private -// internal EventFlags1Args(Action target, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) -// : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) -// { -// this.m_target = target; -// } -// protected override void Dispatch() -// { -// m_target(this); -// } -// protected override void Validate() -// { -// Debug.Assert(!(Version == 0 && EventDataLength != 4)); -// Debug.Assert(!(Version > 0 && EventDataLength < 4)); -// } -// protected override Delegate Target -// { -// get { return m_target; } -// set { m_target = (Action)value; } -// } -// public override StringBuilder ToXml(StringBuilder sb) -// { -// Prefix(sb); -// XmlAttrib(sb, "x", x); -// sb.Append("/>"); -// return sb; -// } - -// public override string[] PayloadNames -// { -// get -// { -// if (payloadNames == null) -// payloadNames = new string[] { "x" }; -// return payloadNames; -// } -// } - -// public override object PayloadValue(int index) -// { -// switch (index) -// { -// case 0: -// return x; -// default: -// Debug.Fail("Bad field index"); -// return null; -// } -// } - -// private event Action m_target; -// #endregion -// } -// public sealed class EventIArgs : TraceEvent -// { -// public int arg1 { get { return GetInt32At(0); } } - -// #region Private -// internal EventIArgs(Action target, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) -// : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) -// { -// this.m_target = target; -// } -// protected override void Dispatch() -// { -// m_target(this); -// } -// protected override void Validate() -// { -// Debug.Assert(!(Version == 0 && EventDataLength != 4)); -// Debug.Assert(!(Version > 0 && EventDataLength < 4)); -// } -// protected override Delegate Target -// { -// get { return m_target; } -// set { m_target = (Action)value; } -// } -// public override StringBuilder ToXml(StringBuilder sb) -// { -// Prefix(sb); -// XmlAttrib(sb, "arg1", arg1); -// sb.Append("/>"); -// return sb; -// } - -// public override string[] PayloadNames -// { -// get -// { -// if (payloadNames == null) -// payloadNames = new string[] { "arg1" }; -// return payloadNames; -// } -// } - -// public override object PayloadValue(int index) -// { -// switch (index) -// { -// case 0: -// return arg1; -// default: -// Debug.Fail("Bad field index"); -// return null; -// } -// } - -// private event Action m_target; -// #endregion -// } -// public sealed class EventIIArgs : TraceEvent -// { -// public int arg1 { get { return GetInt32At(0); } } -// public int arg2 { get { return GetInt32At(4); } } - -// #region Private -// internal EventIIArgs(Action target, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) -// : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) -// { -// this.m_target = target; -// } -// protected override void Dispatch() -// { -// m_target(this); -// } -// protected override void Validate() -// { -// Debug.Assert(!(Version == 0 && EventDataLength != 8)); -// Debug.Assert(!(Version > 0 && EventDataLength < 8)); -// } -// protected override Delegate Target -// { -// get { return m_target; } -// set { m_target = (Action)value; } -// } -// public override StringBuilder ToXml(StringBuilder sb) -// { -// Prefix(sb); -// XmlAttrib(sb, "arg1", arg1); -// XmlAttrib(sb, "arg2", arg2); -// sb.Append("/>"); -// return sb; -// } - -// public override string[] PayloadNames -// { -// get -// { -// if (payloadNames == null) -// payloadNames = new string[] { "arg1", "arg2" }; -// return payloadNames; -// } -// } - -// public override object PayloadValue(int index) -// { -// switch (index) -// { -// case 0: -// return arg1; -// case 1: -// return arg2; -// default: -// Debug.Fail("Bad field index"); -// return null; -// } -// } - -// private event Action m_target; -// #endregion -// } -// public sealed class EventIIIArgs : TraceEvent -// { -// public int arg1 { get { return GetInt32At(0); } } -// public int arg2 { get { return GetInt32At(4); } } -// public int arg3 { get { return GetInt32At(8); } } - -// #region Private -// internal EventIIIArgs(Action target, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) -// : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) -// { -// this.m_target = target; -// } -// protected override void Dispatch() -// { -// m_target(this); -// } -// protected override void Validate() -// { -// Debug.Assert(!(Version == 0 && EventDataLength != 12)); -// Debug.Assert(!(Version > 0 && EventDataLength < 12)); -// } -// protected override Delegate Target -// { -// get { return m_target; } -// set { m_target = (Action)value; } -// } -// public override StringBuilder ToXml(StringBuilder sb) -// { -// Prefix(sb); -// XmlAttrib(sb, "arg1", arg1); -// XmlAttrib(sb, "arg2", arg2); -// XmlAttrib(sb, "arg3", arg3); -// sb.Append("/>"); -// return sb; -// } - -// public override string[] PayloadNames -// { -// get -// { -// if (payloadNames == null) -// payloadNames = new string[] { "arg1", "arg2", "arg3" }; -// return payloadNames; -// } -// } - -// public override object PayloadValue(int index) -// { -// switch (index) -// { -// case 0: -// return arg1; -// case 1: -// return arg2; -// case 2: -// return arg3; -// default: -// Debug.Fail("Bad field index"); -// return null; -// } -// } - -// private event Action m_target; -// #endregion -// } -// public sealed class EventLArgs : TraceEvent -// { -// public long arg1 { get { return GetInt64At(0); } } - -// #region Private -// internal EventLArgs(Action target, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) -// : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) -// { -// this.m_target = target; -// } -// protected override void Dispatch() -// { -// m_target(this); -// } -// protected override void Validate() -// { -// Debug.Assert(!(Version == 0 && EventDataLength != 8)); -// Debug.Assert(!(Version > 0 && EventDataLength < 8)); -// } -// protected override Delegate Target -// { -// get { return m_target; } -// set { m_target = (Action)value; } -// } -// public override StringBuilder ToXml(StringBuilder sb) -// { -// Prefix(sb); -// XmlAttrib(sb, "arg1", arg1); -// sb.Append("/>"); -// return sb; -// } - -// public override string[] PayloadNames -// { -// get -// { -// if (payloadNames == null) -// payloadNames = new string[] { "arg1" }; -// return payloadNames; -// } -// } - -// public override object PayloadValue(int index) -// { -// switch (index) -// { -// case 0: -// return arg1; -// default: -// Debug.Fail("Bad field index"); -// return null; -// } -// } - -// private event Action m_target; -// #endregion -// } -// public sealed class EventLLArgs : TraceEvent -// { -// public long arg1 { get { return GetInt64At(0); } } -// public long arg2 { get { return GetInt64At(8); } } - -// #region Private -// internal EventLLArgs(Action target, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) -// : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) -// { -// this.m_target = target; -// } -// protected override void Dispatch() -// { -// m_target(this); -// } -// protected override void Validate() -// { -// Debug.Assert(!(Version == 0 && EventDataLength != 16)); -// Debug.Assert(!(Version > 0 && EventDataLength < 16)); -// } -// protected override Delegate Target -// { -// get { return m_target; } -// set { m_target = (Action)value; } -// } -// public override StringBuilder ToXml(StringBuilder sb) -// { -// Prefix(sb); -// XmlAttrib(sb, "arg1", arg1); -// XmlAttrib(sb, "arg2", arg2); -// sb.Append("/>"); -// return sb; -// } - -// public override string[] PayloadNames -// { -// get -// { -// if (payloadNames == null) -// payloadNames = new string[] { "arg1", "arg2" }; -// return payloadNames; -// } -// } - -// public override object PayloadValue(int index) -// { -// switch (index) -// { -// case 0: -// return arg1; -// case 1: -// return arg2; -// default: -// Debug.Fail("Bad field index"); -// return null; -// } -// } - -// private event Action m_target; -// #endregion -// } -// public sealed class EventLLLArgs : TraceEvent -// { -// public long arg1 { get { return GetInt64At(0); } } -// public long arg2 { get { return GetInt64At(8); } } -// public long arg3 { get { return GetInt64At(16); } } - -// #region Private -// internal EventLLLArgs(Action target, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) -// : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) -// { -// this.m_target = target; -// } -// protected override void Dispatch() -// { -// m_target(this); -// } -// protected override void Validate() -// { -// Debug.Assert(!(Version == 0 && EventDataLength != 24)); -// Debug.Assert(!(Version > 0 && EventDataLength < 24)); -// } -// protected override Delegate Target -// { -// get { return m_target; } -// set { m_target = (Action)value; } -// } -// public override StringBuilder ToXml(StringBuilder sb) -// { -// Prefix(sb); -// XmlAttrib(sb, "arg1", arg1); -// XmlAttrib(sb, "arg2", arg2); -// XmlAttrib(sb, "arg3", arg3); -// sb.Append("/>"); -// return sb; -// } - -// public override string[] PayloadNames -// { -// get -// { -// if (payloadNames == null) -// payloadNames = new string[] { "arg1", "arg2", "arg3" }; -// return payloadNames; -// } -// } - -// public override object PayloadValue(int index) -// { -// switch (index) -// { -// case 0: -// return arg1; -// case 1: -// return arg2; -// case 2: -// return arg3; -// default: -// Debug.Fail("Bad field index"); -// return null; -// } -// } - -// private event Action m_target; -// #endregion -// } -// public sealed class EventNoAttributesArgs : TraceEvent -// { -// public string s { get { return GetUnicodeStringAt(0); } } - -// #region Private -// internal EventNoAttributesArgs(Action target, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) -// : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) -// { -// this.m_target = target; -// } -// protected override void Dispatch() -// { -// m_target(this); -// } -// protected override void Validate() -// { -// Debug.Assert(!(Version == 0 && EventDataLength != SkipUnicodeString(0))); -// Debug.Assert(!(Version > 0 && EventDataLength < SkipUnicodeString(0))); -// } -// protected override Delegate Target -// { -// get { return m_target; } -// set { m_target = (Action)value; } -// } -// public override StringBuilder ToXml(StringBuilder sb) -// { -// Prefix(sb); -// XmlAttrib(sb, "s", s); -// sb.Append("/>"); -// return sb; -// } - -// public override string[] PayloadNames -// { -// get -// { -// if (payloadNames == null) -// payloadNames = new string[] { "s" }; -// return payloadNames; -// } -// } - -// public override object PayloadValue(int index) -// { -// switch (index) -// { -// case 0: -// return s; -// default: -// Debug.Fail("Bad field index"); -// return null; -// } -// } - -// private event Action m_target; -// #endregion -// } -// public sealed class EventSArgs : TraceEvent -// { -// public string arg1 { get { return GetUnicodeStringAt(0); } } - -// #region Private -// internal EventSArgs(Action target, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) -// : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) -// { -// this.m_target = target; -// } -// protected override void Dispatch() -// { -// m_target(this); -// } -// protected override void Validate() -// { -// Debug.Assert(!(Version == 0 && EventDataLength != SkipUnicodeString(0))); -// Debug.Assert(!(Version > 0 && EventDataLength < SkipUnicodeString(0))); -// } -// protected override Delegate Target -// { -// get { return m_target; } -// set { m_target = (Action)value; } -// } -// public override StringBuilder ToXml(StringBuilder sb) -// { -// Prefix(sb); -// XmlAttrib(sb, "arg1", arg1); -// sb.Append("/>"); -// return sb; -// } - -// public override string[] PayloadNames -// { -// get -// { -// if (payloadNames == null) -// payloadNames = new string[] { "arg1" }; -// return payloadNames; -// } -// } - -// public override object PayloadValue(int index) -// { -// switch (index) -// { -// case 0: -// return arg1; -// default: -// Debug.Fail("Bad field index"); -// return null; -// } -// } - -// private event Action m_target; -// #endregion -// } -// public sealed class EventSIArgs : TraceEvent -// { -// public string arg1 { get { return GetUnicodeStringAt(0); } } -// public int arg2 { get { return GetInt32At(SkipUnicodeString(0)); } } - -// #region Private -// internal EventSIArgs(Action target, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) -// : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) -// { -// this.m_target = target; -// } -// protected override void Dispatch() -// { -// m_target(this); -// } -// protected override void Validate() -// { -// Debug.Assert(!(Version == 0 && EventDataLength != SkipUnicodeString(0) + 4)); -// Debug.Assert(!(Version > 0 && EventDataLength < SkipUnicodeString(0) + 4)); -// } -// protected override Delegate Target -// { -// get { return m_target; } -// set { m_target = (Action)value; } -// } -// public override StringBuilder ToXml(StringBuilder sb) -// { -// Prefix(sb); -// XmlAttrib(sb, "arg1", arg1); -// XmlAttrib(sb, "arg2", arg2); -// sb.Append("/>"); -// return sb; -// } - -// public override string[] PayloadNames -// { -// get -// { -// if (payloadNames == null) -// payloadNames = new string[] { "arg1", "arg2" }; -// return payloadNames; -// } -// } - -// public override object PayloadValue(int index) -// { -// switch (index) -// { -// case 0: -// return arg1; -// case 1: -// return arg2; -// default: -// Debug.Fail("Bad field index"); -// return null; -// } -// } - -// private event Action m_target; -// #endregion -// } -// public sealed class EventSIIArgs : TraceEvent -// { -// public string arg1 { get { return GetUnicodeStringAt(0); } } -// public int arg2 { get { return GetInt32At(SkipUnicodeString(0)); } } -// public int arg3 { get { return GetInt32At(SkipUnicodeString(0) + 4); } } - -// #region Private -// internal EventSIIArgs(Action target, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) -// : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) -// { -// this.m_target = target; -// } -// protected override void Dispatch() -// { -// m_target(this); -// } -// protected override void Validate() -// { -// Debug.Assert(!(Version == 0 && EventDataLength != SkipUnicodeString(0) + 8)); -// Debug.Assert(!(Version > 0 && EventDataLength < SkipUnicodeString(0) + 8)); -// } -// protected override Delegate Target -// { -// get { return m_target; } -// set { m_target = (Action)value; } -// } -// public override StringBuilder ToXml(StringBuilder sb) -// { -// Prefix(sb); -// XmlAttrib(sb, "arg1", arg1); -// XmlAttrib(sb, "arg2", arg2); -// XmlAttrib(sb, "arg3", arg3); -// sb.Append("/>"); -// return sb; -// } - -// public override string[] PayloadNames -// { -// get -// { -// if (payloadNames == null) -// payloadNames = new string[] { "arg1", "arg2", "arg3" }; -// return payloadNames; -// } -// } - -// public override object PayloadValue(int index) -// { -// switch (index) -// { -// case 0: -// return arg1; -// case 1: -// return arg2; -// case 2: -// return arg3; -// default: -// Debug.Fail("Bad field index"); -// return null; -// } -// } - -// private event Action m_target; -// #endregion -// } -// public sealed class EventSLArgs : TraceEvent -// { -// public string arg1 { get { return GetUnicodeStringAt(0); } } -// public long arg2 { get { return GetInt64At(SkipUnicodeString(0)); } } - -// #region Private -// internal EventSLArgs(Action target, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) -// : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) -// { -// this.m_target = target; -// } -// protected override void Dispatch() -// { -// m_target(this); -// } -// protected override void Validate() -// { -// Debug.Assert(!(Version == 0 && EventDataLength != SkipUnicodeString(0) + 8)); -// Debug.Assert(!(Version > 0 && EventDataLength < SkipUnicodeString(0) + 8)); -// } -// protected override Delegate Target -// { -// get { return m_target; } -// set { m_target = (Action)value; } -// } -// public override StringBuilder ToXml(StringBuilder sb) -// { -// Prefix(sb); -// XmlAttrib(sb, "arg1", arg1); -// XmlAttrib(sb, "arg2", arg2); -// sb.Append("/>"); -// return sb; -// } - -// public override string[] PayloadNames -// { -// get -// { -// if (payloadNames == null) -// payloadNames = new string[] { "arg1", "arg2" }; -// return payloadNames; -// } -// } - -// public override object PayloadValue(int index) -// { -// switch (index) -// { -// case 0: -// return arg1; -// case 1: -// return arg2; -// default: -// Debug.Fail("Bad field index"); -// return null; -// } -// } - -// private event Action m_target; -// #endregion -// } -// public sealed class EventSSArgs : TraceEvent -// { -// public string arg1 { get { return GetUnicodeStringAt(0); } } -// public string arg2 { get { return GetUnicodeStringAt(SkipUnicodeString(0)); } } - -// #region Private -// internal EventSSArgs(Action target, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) -// : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) -// { -// this.m_target = target; -// } -// protected override void Dispatch() -// { -// m_target(this); -// } -// protected override void Validate() -// { -// Debug.Assert(!(Version == 0 && EventDataLength != SkipUnicodeString(SkipUnicodeString(0)))); -// Debug.Assert(!(Version > 0 && EventDataLength < SkipUnicodeString(SkipUnicodeString(0)))); -// } -// protected override Delegate Target -// { -// get { return m_target; } -// set { m_target = (Action)value; } -// } -// public override StringBuilder ToXml(StringBuilder sb) -// { -// Prefix(sb); -// XmlAttrib(sb, "arg1", arg1); -// XmlAttrib(sb, "arg2", arg2); -// sb.Append("/>"); -// return sb; -// } - -// public override string[] PayloadNames -// { -// get -// { -// if (payloadNames == null) -// payloadNames = new string[] { "arg1", "arg2" }; -// return payloadNames; -// } -// } - -// public override object PayloadValue(int index) -// { -// switch (index) -// { -// case 0: -// return arg1; -// case 1: -// return arg2; -// default: -// Debug.Fail("Bad field index"); -// return null; -// } -// } - -// private event Action m_target; -// #endregion -// } -// public sealed class EventSSSArgs : TraceEvent -// { -// public string arg1 { get { return GetUnicodeStringAt(0); } } -// public string arg2 { get { return GetUnicodeStringAt(SkipUnicodeString(0)); } } -// public string arg3 { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(0))); } } - -// #region Private -// internal EventSSSArgs(Action target, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) -// : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) -// { -// this.m_target = target; -// } -// protected override void Dispatch() -// { -// m_target(this); -// } -// protected override void Validate() -// { -// Debug.Assert(!(Version == 0 && EventDataLength != SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))); -// Debug.Assert(!(Version > 0 && EventDataLength < SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))); -// } -// protected override Delegate Target -// { -// get { return m_target; } -// set { m_target = (Action)value; } -// } -// public override StringBuilder ToXml(StringBuilder sb) -// { -// Prefix(sb); -// XmlAttrib(sb, "arg1", arg1); -// XmlAttrib(sb, "arg2", arg2); -// XmlAttrib(sb, "arg3", arg3); -// sb.Append("/>"); -// return sb; -// } - -// public override string[] PayloadNames -// { -// get -// { -// if (payloadNames == null) -// payloadNames = new string[] { "arg1", "arg2", "arg3" }; -// return payloadNames; -// } -// } - -// public override object PayloadValue(int index) -// { -// switch (index) -// { -// case 0: -// return arg1; -// case 1: -// return arg2; -// case 2: -// return arg3; -// default: -// Debug.Fail("Bad field index"); -// return null; -// } -// } - -// private event Action m_target; -// #endregion -// } -// public sealed class EventWith7StringsArgs : TraceEvent -// { -// public string s0 { get { return GetUnicodeStringAt(0); } } -// public string s1 { get { return GetUnicodeStringAt(SkipUnicodeString(0)); } } -// public string s2 { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(0))); } } -// public string s3 { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0)))); } } -// public string s4 { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))); } } -// public string s5 { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0)))))); } } -// public string s6 { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))))); } } - -// #region Private -// internal EventWith7StringsArgs(Action target, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) -// : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) -// { -// this.m_target = target; -// } -// protected override void Dispatch() -// { -// m_target(this); -// } -// protected override void Validate() -// { -// Debug.Assert(!(Version == 0 && EventDataLength != SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))))))); -// Debug.Assert(!(Version > 0 && EventDataLength < SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))))))); -// } -// protected override Delegate Target -// { -// get { return m_target; } -// set { m_target = (Action)value; } -// } -// public override StringBuilder ToXml(StringBuilder sb) -// { -// Prefix(sb); -// XmlAttrib(sb, "s0", s0); -// XmlAttrib(sb, "s1", s1); -// XmlAttrib(sb, "s2", s2); -// XmlAttrib(sb, "s3", s3); -// XmlAttrib(sb, "s4", s4); -// XmlAttrib(sb, "s5", s5); -// XmlAttrib(sb, "s6", s6); -// sb.Append("/>"); -// return sb; -// } - -// public override string[] PayloadNames -// { -// get -// { -// if (payloadNames == null) -// payloadNames = new string[] { "s0", "s1", "s2", "s3", "s4", "s5", "s6" }; -// return payloadNames; -// } -// } - -// public override object PayloadValue(int index) -// { -// switch (index) -// { -// case 0: -// return s0; -// case 1: -// return s1; -// case 2: -// return s2; -// case 3: -// return s3; -// case 4: -// return s4; -// case 5: -// return s5; -// case 6: -// return s6; -// default: -// Debug.Fail("Bad field index"); -// return null; -// } -// } - -// private event Action m_target; -// #endregion -// } -// public sealed class EventWith9StringsArgs : TraceEvent -// { -// public string s0 { get { return GetUnicodeStringAt(0); } } -// public string s1 { get { return GetUnicodeStringAt(SkipUnicodeString(0)); } } -// public string s2 { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(0))); } } -// public string s3 { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0)))); } } -// public string s4 { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))); } } -// public string s5 { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0)))))); } } -// public string s6 { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))))); } } -// public string s7 { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0)))))))); } } -// public string s8 { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))))))); } } - -// #region Private -// internal EventWith9StringsArgs(Action target, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) -// : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) -// { -// this.m_target = target; -// } -// protected override void Dispatch() -// { -// m_target(this); -// } -// protected override void Validate() -// { -// Debug.Assert(!(Version == 0 && EventDataLength != SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))))))))); -// Debug.Assert(!(Version > 0 && EventDataLength < SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))))))))); -// } -// protected override Delegate Target -// { -// get { return m_target; } -// set { m_target = (Action)value; } -// } -// public override StringBuilder ToXml(StringBuilder sb) -// { -// Prefix(sb); -// XmlAttrib(sb, "s0", s0); -// XmlAttrib(sb, "s1", s1); -// XmlAttrib(sb, "s2", s2); -// XmlAttrib(sb, "s3", s3); -// XmlAttrib(sb, "s4", s4); -// XmlAttrib(sb, "s5", s5); -// XmlAttrib(sb, "s6", s6); -// XmlAttrib(sb, "s7", s7); -// XmlAttrib(sb, "s8", s8); -// sb.Append("/>"); -// return sb; -// } - -// public override string[] PayloadNames -// { -// get -// { -// if (payloadNames == null) -// payloadNames = new string[] { "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", "s8" }; -// return payloadNames; -// } -// } - -// public override object PayloadValue(int index) -// { -// switch (index) -// { -// case 0: -// return s0; -// case 1: -// return s1; -// case 2: -// return s2; -// case 3: -// return s3; -// case 4: -// return s4; -// case 5: -// return s5; -// case 6: -// return s6; -// case 7: -// return s7; -// case 8: -// return s8; -// default: -// Debug.Fail("Bad field index"); -// return null; -// } -// } - -// private event Action m_target; -// #endregion -// } -// public sealed class EventWithByteArrArgArgs : TraceEvent -// { -// public int blobSize { get { return GetInt32At(0); } } -// public byte[] blob { get { return GetByteArrayAt(4, blobSize); } } -// public int blobAt(int arrayIndex) { return GetByteAt(4 + (arrayIndex * HostOffset(1, 0))); } -// public int n { get { return GetInt32At(0 + (blobSize) + 4); } } - -// #region Private -// internal EventWithByteArrArgArgs(Action target, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) -// : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) -// { -// this.m_target = target; -// } -// protected override void Dispatch() -// { -// m_target(this); -// } -// protected override void Validate() -// { -// Debug.Assert(!(Version == 0 && EventDataLength != 0 + (blobSize * 1) + 8)); -// Debug.Assert(!(Version > 0 && EventDataLength < 0 + (blobSize * 1) + 8)); -// } -// protected override Delegate Target -// { -// get { return m_target; } -// set { m_target = (Action)value; } -// } -// public override StringBuilder ToXml(StringBuilder sb) -// { -// Prefix(sb); -// XmlAttrib(sb, "blobSize", blobSize); -// XmlAttrib(sb, "n", n); -// sb.Append("/>"); -// return sb; -// } - -// public override string[] PayloadNames -// { -// get -// { -// if (payloadNames == null) -// payloadNames = new string[] { "blobSize", "blob", "n" }; -// return payloadNames; -// } -// } - -// public override object PayloadValue(int index) -// { -// switch (index) -// { -// case 0: -// return blobSize; -// case 1: -// return n; -// default: -// Debug.Fail("Bad field index"); -// return null; -// } -// } - -// private event Action m_target; -// #endregion -// } -// public sealed class EventWithBytePtrArgArgs : TraceEvent -// { -// public int blobSize { get { return GetInt32At(0); } } -// public byte[] blob { get { return GetByteArrayAt(4, blobSize); } } -// public int blobAt(int arrayIndex) { return GetByteAt(4 + (arrayIndex * HostOffset(1, 0))); } -// public int n { get { return GetInt32At(0 + (blobSize) + 4); } } - -// #region Private -// internal EventWithBytePtrArgArgs(Action target, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) -// : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) -// { -// this.m_target = target; -// } -// protected override void Dispatch() -// { -// m_target(this); -// } -// protected override void Validate() -// { -// Debug.Assert(!(Version == 0 && EventDataLength != 0 + (blobSize * 1) + 8)); -// Debug.Assert(!(Version > 0 && EventDataLength < 0 + (blobSize * 1) + 8)); -// } -// protected override Delegate Target -// { -// get { return m_target; } -// set { m_target = (Action)value; } -// } -// public override StringBuilder ToXml(StringBuilder sb) -// { -// Prefix(sb); -// XmlAttrib(sb, "blobSize", blobSize); -// XmlAttrib(sb, "n", n); -// sb.Append("/>"); -// return sb; -// } - -// public override string[] PayloadNames -// { -// get -// { -// if (payloadNames == null) -// payloadNames = new string[] { "blobSize", "blob", "n" }; -// return payloadNames; -// } -// } - -// public override object PayloadValue(int index) -// { -// switch (index) -// { -// case 0: -// return blobSize; -// case 1: -// return n; -// default: -// Debug.Fail("Bad field index"); -// return null; -// } -// } - -// private event Action m_target; -// #endregion -// } -// public sealed class EventWithEscapingMessageArgs : TraceEvent -// { -// public string msg { get { return GetUnicodeStringAt(0); } } -// public int n { get { return GetInt32At(SkipUnicodeString(0)); } } - -// #region Private -// internal EventWithEscapingMessageArgs(Action target, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) -// : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) -// { -// this.m_target = target; -// } -// protected override void Dispatch() -// { -// m_target(this); -// } -// protected override void Validate() -// { -// Debug.Assert(!(Version == 0 && EventDataLength != SkipUnicodeString(0) + 4)); -// Debug.Assert(!(Version > 0 && EventDataLength < SkipUnicodeString(0) + 4)); -// } -// protected override Delegate Target -// { -// get { return m_target; } -// set { m_target = (Action)value; } -// } -// public override StringBuilder ToXml(StringBuilder sb) -// { -// Prefix(sb); -// XmlAttrib(sb, "msg", msg); -// XmlAttrib(sb, "n", n); -// sb.Append("/>"); -// return sb; -// } - -// public override string[] PayloadNames -// { -// get -// { -// if (payloadNames == null) -// payloadNames = new string[] { "msg", "n" }; -// return payloadNames; -// } -// } - -// public override object PayloadValue(int index) -// { -// switch (index) -// { -// case 0: -// return msg; -// case 1: -// return n; -// default: -// Debug.Fail("Bad field index"); -// return null; -// } -// } - -// private event Action m_target; -// #endregion -// } -// public sealed class EventWithManyTypeArgsArgs : TraceEvent -// { -// public string msg { get { return GetUnicodeStringAt(0); } } -// public long l { get { return GetInt64At(SkipUnicodeString(0)); } } -// public int ui { get { return GetInt32At(SkipUnicodeString(0) + 8); } } -// public long ui64 { get { return GetInt64At(SkipUnicodeString(0) + 12); } } -// public int ch { get { return GetInt16At(SkipUnicodeString(0) + 20); } } -// public int b { get { return GetByteAt(SkipUnicodeString(0) + 22); } } -// public int sb { get { return GetByteAt(SkipUnicodeString(0) + 23); } } -// public int sh { get { return GetInt16At(SkipUnicodeString(0) + 24); } } -// public int ush { get { return GetInt16At(SkipUnicodeString(0) + 26); } } -// public float f { get { return GetSingleAt(SkipUnicodeString(0) + 28); } } -// public double d { get { return GetDoubleAt(SkipUnicodeString(0) + 32); } } -// public Guid guid { get { return GetGuidAt(SkipUnicodeString(0) + 40); } } - -// #region Private -// internal EventWithManyTypeArgsArgs(Action target, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) -// : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) -// { -// this.m_target = target; -// } -// protected override void Dispatch() -// { -// m_target(this); -// } -// protected override void Validate() -// { -// Debug.Assert(!(Version == 0 && EventDataLength != SkipUnicodeString(0) + 56)); -// Debug.Assert(!(Version > 0 && EventDataLength < SkipUnicodeString(0) + 56)); -// } -// protected override Delegate Target -// { -// get { return m_target; } -// set { m_target = (Action)value; } -// } -// public override StringBuilder ToXml(StringBuilder sb) -// { -// Prefix(sb); -// XmlAttrib(sb, "msg", msg); -// XmlAttrib(sb, "l", l); -// XmlAttrib(sb, "ui", ui); -// XmlAttrib(sb, "ui64", ui64); -// XmlAttrib(sb, "ch", ch); -// XmlAttrib(sb, "b", b); -// XmlAttrib(sb, "sb", sb); -// XmlAttrib(sb, "sh", sh); -// XmlAttrib(sb, "ush", ush); -// XmlAttrib(sb, "f", f); -// XmlAttrib(sb, "d", d); -// XmlAttrib(sb, "guid", guid); -// sb.Append("/>"); -// return sb; -// } - -// public override string[] PayloadNames -// { -// get -// { -// if (payloadNames == null) -// payloadNames = new string[] { "msg", "l", "ui", "ui64", "ch", "b", "sb", "sh", "ush", "f", "d", "guid" }; -// return payloadNames; -// } -// } - -// public override object PayloadValue(int index) -// { -// switch (index) -// { -// case 0: -// return msg; -// case 1: -// return l; -// case 2: -// return ui; -// case 3: -// return ui64; -// case 4: -// return ch; -// case 5: -// return b; -// case 6: -// return sb; -// case 7: -// return sh; -// case 8: -// return ush; -// case 9: -// return f; -// case 10: -// return d; -// case 11: -// return guid; -// default: -// Debug.Fail("Bad field index"); -// return null; -// } -// } - -// private event Action m_target; -// #endregion -// } -// public sealed class EventWithMoreEscapingMessageArgs : TraceEvent -// { -// public string msg { get { return GetUnicodeStringAt(0); } } -// public int percentage { get { return GetInt32At(SkipUnicodeString(0)); } } - -// #region Private -// internal EventWithMoreEscapingMessageArgs(Action target, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) -// : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) -// { -// this.m_target = target; -// } -// protected override void Dispatch() -// { -// m_target(this); -// } -// protected override void Validate() -// { -// Debug.Assert(!(Version == 0 && EventDataLength != SkipUnicodeString(0) + 4)); -// Debug.Assert(!(Version > 0 && EventDataLength < SkipUnicodeString(0) + 4)); -// } -// protected override Delegate Target -// { -// get { return m_target; } -// set { m_target = (Action)value; } -// } -// public override StringBuilder ToXml(StringBuilder sb) -// { -// Prefix(sb); -// XmlAttrib(sb, "msg", msg); -// XmlAttrib(sb, "percentage", percentage); -// sb.Append("/>"); -// return sb; -// } - -// public override string[] PayloadNames -// { -// get -// { -// if (payloadNames == null) -// payloadNames = new string[] { "msg", "percentage" }; -// return payloadNames; -// } -// } - -// public override object PayloadValue(int index) -// { -// switch (index) -// { -// case 0: -// return msg; -// case 1: -// return percentage; -// default: -// Debug.Fail("Bad field index"); -// return null; -// } -// } - -// private event Action m_target; -// #endregion -// } -// public sealed class EventWithWeirdArgsArgs : TraceEvent -// { -// public Address iptr { get { return GetAddressAt(0); } } -// public bool b { get { return GetInt32At(HostOffset(4, 1)) != 0; } } -// public long le { get { return GetInt64At(HostOffset(8, 1)); } } - -// #region Private -// internal EventWithWeirdArgsArgs(Action target, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) -// : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) -// { -// this.m_target = target; -// } -// protected override void Dispatch() -// { -// m_target(this); -// } -// protected override void Validate() -// { -// Debug.Assert(!(Version == 0 && EventDataLength != HostOffset(16, 1))); -// Debug.Assert(!(Version > 0 && EventDataLength < HostOffset(16, 1))); -// } -// protected override Delegate Target -// { -// get { return m_target; } -// set { m_target = (Action)value; } -// } -// public override StringBuilder ToXml(StringBuilder sb) -// { -// Prefix(sb); -// XmlAttribHex(sb, "iptr", iptr); -// XmlAttrib(sb, "b", b); -// XmlAttrib(sb, "le", le); -// sb.Append("/>"); -// return sb; -// } - -// public override string[] PayloadNames -// { -// get -// { -// if (payloadNames == null) -// payloadNames = new string[] { "iptr", "b", "le" }; -// return payloadNames; -// } -// } - -// public override object PayloadValue(int index) -// { -// switch (index) -// { -// case 0: -// return iptr; -// case 1: -// return b; -// case 2: -// return le; -// default: -// Debug.Fail("Bad field index"); -// return null; -// } -// } - -// private event Action m_target; -// #endregion -// } -// public sealed class MessageArgs : TraceEvent -// { -// public string arg1 { get { return GetUnicodeStringAt(0); } } - -// #region Private -// internal MessageArgs(Action target, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) -// : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) -// { -// this.m_target = target; -// } -// protected override void Dispatch() -// { -// m_target(this); -// } -// protected override void Validate() -// { -// Debug.Assert(!(Version == 0 && EventDataLength != SkipUnicodeString(0))); -// Debug.Assert(!(Version > 0 && EventDataLength < SkipUnicodeString(0))); -// } -// protected override Delegate Target -// { -// get { return m_target; } -// set { m_target = (Action)value; } -// } -// public override StringBuilder ToXml(StringBuilder sb) -// { -// Prefix(sb); -// XmlAttrib(sb, "arg1", arg1); -// sb.Append("/>"); -// return sb; -// } - -// public override string[] PayloadNames -// { -// get -// { -// if (payloadNames == null) -// payloadNames = new string[] { "arg1" }; -// return payloadNames; -// } -// } - -// public override object PayloadValue(int index) -// { -// switch (index) -// { -// case 0: -// return arg1; -// default: -// Debug.Fail("Bad field index"); -// return null; -// } -// } - -// private event Action m_target; -// #endregion -// } -// public sealed class SlowerHelperArgs : TraceEvent -// { -// public int arg1 { get { return GetInt32At(0); } } -// public string arg2 { get { return GetUnicodeStringAt(4); } } - -// #region Private -// internal SlowerHelperArgs(Action target, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) -// : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) -// { -// this.m_target = target; -// } -// protected override void Dispatch() -// { -// m_target(this); -// } -// protected override void Validate() -// { -// Debug.Assert(!(Version == 0 && EventDataLength != SkipUnicodeString(4))); -// Debug.Assert(!(Version > 0 && EventDataLength < SkipUnicodeString(4))); -// } -// protected override Delegate Target -// { -// get { return m_target; } -// set { m_target = (Action)value; } -// } -// public override StringBuilder ToXml(StringBuilder sb) -// { -// Prefix(sb); -// XmlAttrib(sb, "arg1", arg1); -// XmlAttrib(sb, "arg2", arg2); -// sb.Append("/>"); -// return sb; -// } - -// public override string[] PayloadNames -// { -// get -// { -// if (payloadNames == null) -// payloadNames = new string[] { "arg1", "arg2" }; -// return payloadNames; -// } -// } - -// public override object PayloadValue(int index) -// { -// switch (index) -// { -// case 0: -// return arg1; -// case 1: -// return arg2; -// default: -// Debug.Fail("Bad field index"); -// return null; -// } -// } - -// private event Action m_target; -// #endregion -// } -// public sealed class EventDateTimeArgs : TraceEvent -// { -// public DateTime dt { get { return DateTime.FromFileTime(GetInt64At(0)); } } - -// #region Private -// internal EventDateTimeArgs(Action target, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) -// : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) -// { -// this.m_target = target; -// } -// protected override void Dispatch() -// { -// m_target(this); -// } -// protected override void Validate() -// { -// Debug.Assert(!(Version == 0 && EventDataLength != 8)); -// Debug.Assert(!(Version > 0 && EventDataLength < 8)); -// } -// protected override Delegate Target -// { -// get { return m_target; } -// set { m_target = (Action)value; } -// } -// public override StringBuilder ToXml(StringBuilder sb) -// { -// Prefix(sb); -// XmlAttrib(sb, "dt", dt); -// sb.Append("/>"); -// return sb; -// } - -// public override string[] PayloadNames -// { -// get -// { -// if (payloadNames == null) -// payloadNames = new string[] { "dt" }; -// return payloadNames; -// } -// } - -// public override object PayloadValue(int index) -// { -// switch (index) -// { -// case 0: -// return dt; -// default: -// Debug.Fail("Bad field index"); -// return null; -// } -// } - -// private event Action m_target; -// #endregion -// } -// public sealed class LogTaskScheduledBadArgs : TraceEvent -// { -// public string message { get { return GetUnicodeStringAt(0); } } - -// #region Private -// internal LogTaskScheduledBadArgs(Action target, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) -// : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) -// { -// this.m_target = target; -// } -// protected override void Dispatch() -// { -// m_target(this); -// } -// protected override void Validate() -// { -// Debug.Assert(!(Version == 0 && EventDataLength != SkipUnicodeString(0))); -// Debug.Assert(!(Version > 0 && EventDataLength < SkipUnicodeString(0))); -// } -// protected override Delegate Target -// { -// get { return m_target; } -// set { m_target = (Action)value; } -// } -// public override StringBuilder ToXml(StringBuilder sb) -// { -// Prefix(sb); -// XmlAttrib(sb, "message", message); -// sb.Append("/>"); -// return sb; -// } - -// public override string[] PayloadNames -// { -// get -// { -// if (payloadNames == null) -// payloadNames = new string[] { "message" }; -// return payloadNames; -// } -// } - -// public override object PayloadValue(int index) -// { -// switch (index) -// { -// case 0: -// return message; -// default: -// Debug.Fail("Bad field index"); -// return null; -// } -// } - -// private event Action m_target; -// #endregion -// } -// public sealed class LogTaskScheduledArgs : TraceEvent -// { -// public string message { get { return GetUnicodeStringAt(0); } } - -// #region Private -// internal LogTaskScheduledArgs(Action target, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) -// : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) -// { -// this.m_target = target; -// } -// protected override void Dispatch() -// { -// m_target(this); -// } -// protected override void Validate() -// { -// Debug.Assert(!(Version == 0 && EventDataLength != SkipUnicodeString(0))); -// Debug.Assert(!(Version > 0 && EventDataLength < SkipUnicodeString(0))); -// } -// protected override Delegate Target -// { -// get { return m_target; } -// set { m_target = (Action)value; } -// } -// public override StringBuilder ToXml(StringBuilder sb) -// { -// Prefix(sb); -// XmlAttrib(sb, "message", message); -// sb.Append("/>"); -// return sb; -// } - -// public override string[] PayloadNames -// { -// get -// { -// if (payloadNames == null) -// payloadNames = new string[] { "message" }; -// return payloadNames; -// } -// } - -// public override object PayloadValue(int index) -// { -// switch (index) -// { -// case 0: -// return message; -// default: -// Debug.Fail("Bad field index"); -// return null; -// } -// } - -// private event Action m_target; -// #endregion -// } -// public sealed class EventWithXferManyTypeArgsArgs : TraceEvent -// { -// public long l { get { return GetInt64At(0); } } -// public int ui { get { return GetInt32At(8); } } -// public long ui64 { get { return GetInt64At(12); } } -// public int ch { get { return GetInt16At(20); } } -// public int b { get { return GetByteAt(22); } } -// public int sb { get { return GetByteAt(23); } } -// public int sh { get { return GetInt16At(24); } } -// public int ush { get { return GetInt16At(26); } } -// public float f { get { return GetSingleAt(28); } } -// public double d { get { return GetDoubleAt(32); } } -// public Guid guid { get { return GetGuidAt(40); } } - -// #region Private -// internal EventWithXferManyTypeArgsArgs(Action target, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) -// : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) -// { -// this.m_target = target; -// } -// protected override void Dispatch() -// { -// m_target(this); -// } -// protected override void Validate() -// { -// Debug.Assert(!(Version == 0 && EventDataLength != 56)); -// Debug.Assert(!(Version > 0 && EventDataLength < 56)); -// } -// protected override Delegate Target -// { -// get { return m_target; } -// set { m_target = (Action)value; } -// } -// public override StringBuilder ToXml(StringBuilder sb) -// { -// Prefix(sb); -// XmlAttrib(sb, "l", l); -// XmlAttrib(sb, "ui", ui); -// XmlAttrib(sb, "ui64", ui64); -// XmlAttrib(sb, "ch", ch); -// XmlAttrib(sb, "b", b); -// XmlAttrib(sb, "sb", sb); -// XmlAttrib(sb, "sh", sh); -// XmlAttrib(sb, "ush", ush); -// XmlAttrib(sb, "f", f); -// XmlAttrib(sb, "d", d); -// XmlAttrib(sb, "guid", guid); -// sb.Append("/>"); -// return sb; -// } - -// public override string[] PayloadNames -// { -// get -// { -// if (payloadNames == null) -// payloadNames = new string[] { "l", "ui", "ui64", "ch", "b", "sb", "sh", "ush", "f", "d", "guid" }; -// return payloadNames; -// } -// } - -// public override object PayloadValue(int index) -// { -// switch (index) -// { -// case 0: -// return l; -// case 1: -// return ui; -// case 2: -// return ui64; -// case 3: -// return ch; -// case 4: -// return b; -// case 5: -// return sb; -// case 6: -// return sh; -// case 7: -// return ush; -// case 8: -// return f; -// case 9: -// return d; -// case 10: -// return guid; -// default: -// Debug.Fail("Bad field index"); -// return null; -// } -// } - -// private event Action m_target; -// #endregion -// } -// public sealed class EventWithXferWeirdArgsArgs : TraceEvent -// { -// public Address iptr { get { return GetAddressAt(0); } } -// public bool b { get { return GetInt32At(HostOffset(4, 1)) != 0; } } -// public long le { get { return GetInt64At(HostOffset(8, 1)); } } - -// #region Private -// internal EventWithXferWeirdArgsArgs(Action target, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) -// : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) -// { -// this.m_target = target; -// } -// protected override void Dispatch() -// { -// m_target(this); -// } -// protected override void Validate() -// { -// Debug.Assert(!(Version == 0 && EventDataLength != HostOffset(16, 1))); -// Debug.Assert(!(Version > 0 && EventDataLength < HostOffset(16, 1))); -// } -// protected override Delegate Target -// { -// get { return m_target; } -// set { m_target = (Action)value; } -// } -// public override StringBuilder ToXml(StringBuilder sb) -// { -// Prefix(sb); -// XmlAttribHex(sb, "iptr", iptr); -// XmlAttrib(sb, "b", b); -// XmlAttrib(sb, "le", le); -// sb.Append("/>"); -// return sb; -// } - -// public override string[] PayloadNames -// { -// get -// { -// if (payloadNames == null) -// payloadNames = new string[] { "iptr", "b", "le" }; -// return payloadNames; -// } -// } - -// public override object PayloadValue(int index) -// { -// switch (index) -// { -// case 0: -// return iptr; -// case 1: -// return b; -// case 2: -// return le; -// default: -// Debug.Fail("Bad field index"); -// return null; -// } -// } - -// private event Action m_target; -// #endregion -// } -// public enum MyColor -// { -// Red = 0x0, -// Blue = 0x1, -// Green = 0x2, -// } -// [Flags] -// public enum MyFlags -// { -// Flag1 = 0x1, -// Flag2 = 0x2, -// Flag3 = 0x4, -// } -//} diff --git a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/FuzzyTests.Etw.cs b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/FuzzyTests.Etw.cs index d15c1d4a09552..64247aa8fd66c 100644 --- a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/FuzzyTests.Etw.cs +++ b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/FuzzyTests.Etw.cs @@ -3,11 +3,7 @@ using System; using System.Collections.Generic; -#if USE_MDT_EVENTSOURCE -using Microsoft.Diagnostics.Tracing; -#else using System.Diagnostics.Tracing; -#endif namespace BasicEventSourceTests { diff --git a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/FuzzyTests.cs b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/FuzzyTests.cs index 9964a984ef39c..e409b371d70b1 100644 --- a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/FuzzyTests.cs +++ b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/FuzzyTests.cs @@ -6,11 +6,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -#if USE_MDT_EVENTSOURCE -using Microsoft.Diagnostics.Tracing; -#else using System.Diagnostics.Tracing; -#endif using Xunit; namespace BasicEventSourceTests diff --git a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/Harness/EtwListener.cs b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/Harness/EtwListener.cs index 7e514b20f1a19..13750cc99b782 100644 --- a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/Harness/EtwListener.cs +++ b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/Harness/EtwListener.cs @@ -7,11 +7,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; -#if USE_MDT_EVENTSOURCE -using Microsoft.Diagnostics.Tracing; -#else using System.Diagnostics.Tracing; -#endif using System.IO; using System.Threading; using System.Threading.Tasks; diff --git a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/Harness/EventTestHarness.cs b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/Harness/EventTestHarness.cs index fc6d5101c5636..278a8bbedf427 100644 --- a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/Harness/EventTestHarness.cs +++ b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/Harness/EventTestHarness.cs @@ -1,15 +1,11 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#if USE_MDT_EVENTSOURCE -using Microsoft.Diagnostics.Tracing; -#else -using System.Diagnostics.Tracing; -#endif -using Xunit; using System; using System.Collections.Generic; +using System.Diagnostics.Tracing; using System.IO; +using Xunit; namespace BasicEventSourceTests { diff --git a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/Harness/Listeners.cs b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/Harness/Listeners.cs index eddcb636f6f7f..08c02712f3812 100644 --- a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/Harness/Listeners.cs +++ b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/Harness/Listeners.cs @@ -3,16 +3,9 @@ using System; using System.Collections.Generic; -using System.Diagnostics; -#if USE_MDT_EVENTSOURCE -using Microsoft.Diagnostics.Tracing; -#else using System.Diagnostics.Tracing; -#endif -using System.IO; using System.Text; using System.Threading; -using System.Threading.Tasks; using Xunit; namespace BasicEventSourceTests diff --git a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/LoudListener.cs b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/LoudListener.cs index 51bb719221c5e..ce6d7e8fe1918 100644 --- a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/LoudListener.cs +++ b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/LoudListener.cs @@ -3,11 +3,7 @@ using System; using System.Diagnostics; -#if USE_MDT_EVENTSOURCE -using Microsoft.Diagnostics.Tracing; -#else using System.Diagnostics.Tracing; -#endif namespace BasicEventSourceTests { diff --git a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestCallbacks.cs b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestCallbacks.cs index f037c92bd5c68..de609f793c8a7 100644 --- a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestCallbacks.cs +++ b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestCallbacks.cs @@ -3,16 +3,12 @@ using System; using System.Collections.Generic; +using System.Diagnostics.Tracing; using System.Linq; +using System.Reflection; using System.Text; using System.Threading.Tasks; using Xunit; -#if USE_MDT_EVENTSOURCE -using Microsoft.Diagnostics.Tracing; -#else -using System.Diagnostics.Tracing; -#endif -using System.Reflection; namespace BasicEventSourceTests { diff --git a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestEventCounter.cs b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestEventCounter.cs index 523047228aa2c..d1efa10ebb64f 100644 --- a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestEventCounter.cs +++ b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestEventCounter.cs @@ -1,15 +1,11 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#if USE_MDT_EVENTSOURCE -using Microsoft.Diagnostics.Tracing; -#else -using System.Diagnostics.Tracing; -#endif -using Xunit; using System; using System.Collections.Generic; +using System.Diagnostics.Tracing; using System.Threading; +using Xunit; namespace BasicEventSourceTests { diff --git a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestFilter.cs b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestFilter.cs index f496ce6369744..ab7dc62343b83 100644 --- a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestFilter.cs +++ b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestFilter.cs @@ -1,13 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; -using System.Collections.ObjectModel; -#if USE_MDT_EVENTSOURCE -using Microsoft.Diagnostics.Tracing; -#else using System.Diagnostics.Tracing; -#endif using Xunit; namespace BasicEventSourceTests diff --git a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestNotSupported.cs b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestNotSupported.cs index 7d56d1b29af75..7fb31d6c2d60d 100644 --- a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestNotSupported.cs +++ b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestNotSupported.cs @@ -1,15 +1,11 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Collections.Generic; -using Xunit; using SdtEventSources; -using Microsoft.DotNet.RemoteExecutor; -#if USE_MDT_EVENTSOURCE -using Microsoft.Diagnostics.Tracing; -#else +using System.Collections.Generic; using System.Diagnostics.Tracing; -#endif +using Microsoft.DotNet.RemoteExecutor; +using Xunit; namespace BasicEventSourceTests { diff --git a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestShutdown.cs b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestShutdown.cs deleted file mode 100644 index c6af4e728ef2f..0000000000000 --- a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestShutdown.cs +++ /dev/null @@ -1,112 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#if USE_MDT_EVENTSOURCE -using Microsoft.Diagnostics.Tracing; -#else -using System.Diagnostics.Tracing; -#endif - -namespace BasicEventSourceTests -{ - public class TestShutdown - { - // TODO: Depends on .NET Framework APIs (AppDomainSetup and Evidence). -#if FALSE - /// - /// Test for manifest event being logged during AD/Process shutdown during EventSource Dispose(bool) method. - /// - [Fact] - public void Test_EventSource_ShutdownManifest() - { - TestUtilities.CheckNoEventSourcesRunning("Start"); - Debug.WriteLine("Logging more than 1MB of events..."); - OverflowCircularBufferTest(); - Debug.WriteLine("Success..."); - TestUtilities.CheckNoEventSourcesRunning("Stop"); - } - - public void OverflowCircularBufferTest() - { - string dataFileName = "OverflowData.etl"; - - var sessionName = Path.GetFileNameWithoutExtension(dataFileName) + "Session"; - var logger = ADShutdownEventSourceTester.ADShutdownEventSource.Log; - - // Normalize to a full path name. - dataFileName = Path.GetFullPath(dataFileName); - Debug.WriteLine(String.Format("Creating data file {0}", dataFileName)); - - TraceEventSession session = null; - using (session = new TraceEventSession(sessionName, dataFileName)) - { - // Turn on the eventSource given its name. - session.CircularBufferMB = 1; - session.BufferSizeMB = 1; - session.EnableProvider(logger.Name); - - Thread.Sleep(100); // Enabling is async. Wait a bit. - - // Generate events for all the tests, surrounded by events that tell us we are starting a test. - var info = new AppDomainSetup { ApplicationBase = AppDomain.CurrentDomain.BaseDirectory }; - var appDomain = - AppDomain.CreateDomain("TestShutdownAD", new Evidence(), info); - byte[] b = new byte[1000]; - var tester = (ADShutdownEventSourceTester)appDomain - .CreateInstanceAndUnwrap( - typeof(TestShutdown).Assembly.GetName().Name, - typeof(ADShutdownEventSourceTester).FullName); - - for (int i = 0; i < 1500; i++) - { - tester.LogBytes(b); - } - // Unload the AD and expect the manifest to be logged. - AppDomain.Unload(appDomain); - session.Flush(); - } - - // Parse ETL and search for manifest events - using (var traceEventSource = new ETWTraceEventSource(dataFileName)) - { - bool hasManifestEvents = false; - Action onEvent = delegate (TraceEvent data) - { - // Check for manifest events. - if ((int)data.ID == 0xFFFE) - hasManifestEvents = true; - }; - - // Parse all the events as best we can, and also send unhandled events there as well. - traceEventSource.Dynamic.All += onEvent; - traceEventSource.UnhandledEvent += onEvent; - traceEventSource.Process(); - - // Expect at least one manifest event. - Assert.True(hasManifestEvents); - } - - logger.Dispose(); - } -#endif - - public sealed class ADShutdownEventSourceTester //: MarshalByRefObject - { - public void LogBytes(byte[] b) - { - ADShutdownEventSource.Log.MyEvent(b); - } - - public class ADShutdownEventSource : EventSource - { - public static readonly ADShutdownEventSource Log = new ADShutdownEventSource(); - - [Event(1)] - public void MyEvent(byte[] b) - { - this.WriteEvent(1, b); - } - } - } - } -} diff --git a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestUtilities.cs b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestUtilities.cs index e78e57d7946d6..ec7c8f1c2cd32 100644 --- a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestUtilities.cs +++ b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestUtilities.cs @@ -1,15 +1,10 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#if USE_MDT_EVENTSOURCE -using Microsoft.Diagnostics.Tracing; -#else using System.Diagnostics.Tracing; -#endif using System.Diagnostics; -using Xunit; -using System; using System.Collections.Generic; +using Xunit; namespace BasicEventSourceTests { diff --git a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsEventSourceLifetime.cs b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsEventSourceLifetime.cs index a86b7662fb7fe..9e86e94b363c2 100644 --- a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsEventSourceLifetime.cs +++ b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsEventSourceLifetime.cs @@ -2,17 +2,9 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Xunit; -#if USE_MDT_EVENTSOURCE -using Microsoft.Diagnostics.Tracing; -#else using System.Diagnostics.Tracing; -#endif using System.Reflection; +using Xunit; namespace BasicEventSourceTests { diff --git a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsManifestGeneration.Etw.cs b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsManifestGeneration.Etw.cs index b1075c4bfacc7..8f8056cb92d7a 100644 --- a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsManifestGeneration.Etw.cs +++ b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsManifestGeneration.Etw.cs @@ -5,14 +5,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.IO; -using System.Linq; -using System.Text; using System.Threading; -#if USE_MDT_EVENTSOURCE -using Microsoft.Diagnostics.Tracing; -#else -using System.Diagnostics.Tracing; -#endif using Xunit; using SdtEventSources; diff --git a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsManifestGeneration.cs b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsManifestGeneration.cs index 71f5e8e4af36d..e3df9a9a4d528 100644 --- a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsManifestGeneration.cs +++ b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsManifestGeneration.cs @@ -2,22 +2,12 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; -using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.Linq; +using System.Reflection; using System.Text; -#if USE_MDT_EVENTSOURCE -using Microsoft.Diagnostics.Tracing; -#else -using System.Diagnostics.Tracing; -#endif using Xunit; -using System.Reflection; - -using SdtEventSources; -using System.Diagnostics; -using System.Threading; -using System.Text.RegularExpressions; namespace BasicEventSourceTests { diff --git a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsManifestNegative.cs b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsManifestNegative.cs index edd638b679dac..49a8a36fcbbfd 100644 --- a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsManifestNegative.cs +++ b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsManifestNegative.cs @@ -2,17 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; -using System.Reflection; -using System.Globalization; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -#if USE_MDT_EVENTSOURCE -using Microsoft.Diagnostics.Tracing; -#else using System.Diagnostics.Tracing; -#endif +using System.Reflection; using Xunit; using Sdt = SdtEventSources; diff --git a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsTraits.cs b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsTraits.cs index 2b1a208ae8c0b..6221bf677682d 100644 --- a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsTraits.cs +++ b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsTraits.cs @@ -1,13 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#if USE_MDT_EVENTSOURCE -using Microsoft.Diagnostics.Tracing; -#else using System.Diagnostics.Tracing; -#endif using Xunit; -using System; namespace BasicEventSourceTests { diff --git a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsUserErrors.cs b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsUserErrors.cs index eee0aeaa079dc..b738b2f84c763 100644 --- a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsUserErrors.cs +++ b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsUserErrors.cs @@ -1,16 +1,11 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#if USE_MDT_EVENTSOURCE -using Microsoft.Diagnostics.Tracing; -#else -using System.Diagnostics.Tracing; -#endif -using Xunit; using System; -using System.Collections.Generic; using System.Diagnostics; -using System.Text.RegularExpressions; +using System.Diagnostics.Tracing; +using System.Collections.Generic; +using Xunit; namespace BasicEventSourceTests { @@ -150,38 +145,6 @@ private void Test_Bad_EventSource_Startup(bool onStartup, Listener listener, Eve Assert.Equal(0, ea.Version); } } - - [Fact] - public void Test_Bad_WriteRelatedID_ParameterName() - { -#if true - Debug.WriteLine("Test disabled because the fix it tests is not in CoreCLR yet."); -#else - Guid oldGuid; - Guid newGuid = Guid.NewGuid(); - Guid newGuid2 = Guid.NewGuid(); - EventSource.SetCurrentThreadActivityId(newGuid, out oldGuid); - - using (var bes = new BadEventSource_IncorrectWriteRelatedActivityIDFirstParameter()) - using (var listener = new EventListenerListener()) - { - var events = new List(); - listener.OnEvent = delegate (Event data) { events.Add(data); }; - - listener.EventSourceCommand(bes.Name, EventCommand.Enable); - - bes.RelatedActivity(newGuid2, "Hello", 42, "AA", "BB"); - - // Confirm that we get exactly one event from this whole process, that has the error message we expect. - Assert.Equal(1, events.Count); - Event _event = events[0]; - Assert.Equal("EventSourceMessage", _event.EventName); - string message = _event.PayloadString(0, "message"); - // expected message: "EventSource expects the first parameter of the Event method to be of type Guid and to be named "relatedActivityId" when calling WriteEventWithRelatedActivityId." - Assert.Contains("EventSource expects the first parameter of the Event method to be of type Guid and to be named \"relatedActivityId\" when calling WriteEventWithRelatedActivityId.", message); - } -#endif - } } /// @@ -196,34 +159,6 @@ public BadEventSource_MismatchedIds(EventSourceSettings settings) : base(setting public void Event2(int arg) { WriteEvent(1, arg); } } - /// - /// A manifest based provider with a bad type byte[] - /// - internal class BadEventSource_Bad_Type_ByteArray : EventSource - { - public void Event1(byte[] myArray) { WriteEvent(1, myArray); } - } - - public sealed class BadEventSource_IncorrectWriteRelatedActivityIDFirstParameter : EventSource - { - public void E2() - { - this.Write("sampleevent", new { a = "a string" }); - } - - [Event(7, Keywords = Keywords.Debug, Message = "Hello Message 7", Channel = EventChannel.Admin, Opcode = EventOpcode.Send)] - - public void RelatedActivity(Guid guid, string message, int value, string componentName, string instanceId) - { - WriteEventWithRelatedActivityId(7, guid, message, value, componentName, instanceId); - } - - public class Keywords - { - public const EventKeywords Debug = (EventKeywords)0x0002; - } - } - [EventData] public class UserClass { diff --git a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsWrite.cs b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsWrite.cs index c8abf5f8844e4..6371f7290f92b 100644 --- a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsWrite.cs +++ b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsWrite.cs @@ -3,13 +3,9 @@ using System; using System.Collections.Generic; -#if USE_MDT_EVENTSOURCE -using Microsoft.Diagnostics.Tracing; -#else +using System.Diagnostics; using System.Diagnostics.Tracing; -#endif using Xunit; -using System.Diagnostics; namespace BasicEventSourceTests { diff --git a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsWriteEvent.cs b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsWriteEvent.cs index 683ee1a67317b..161ad458edfe4 100644 --- a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsWriteEvent.cs +++ b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsWriteEvent.cs @@ -3,15 +3,9 @@ using System; using System.Collections.Generic; -using Xunit; - -#if USE_MDT_EVENTSOURCE -using Microsoft.Diagnostics.Tracing; -#else using System.Diagnostics.Tracing; -#endif -using System.Text.RegularExpressions; using SdtEventSources; +using Xunit; namespace BasicEventSourceTests { diff --git a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsWriteEventToListener.Etw.cs b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsWriteEventToListener.Etw.cs index 6d3eb85fc0e24..f269bc783b4c3 100644 --- a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsWriteEventToListener.Etw.cs +++ b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsWriteEventToListener.Etw.cs @@ -4,11 +4,6 @@ using System; using SdtEventSources; using Xunit; -#if USE_MDT_EVENTSOURCE -using Microsoft.Diagnostics.Tracing; -#else -using System.Diagnostics.Tracing; -#endif namespace BasicEventSourceTests { diff --git a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsWriteEventToListener.cs b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsWriteEventToListener.cs index fd5ff41c332b6..36607510b9c1c 100644 --- a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsWriteEventToListener.cs +++ b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsWriteEventToListener.cs @@ -3,15 +3,10 @@ using System; using System.Collections.Generic; -using System.Linq; -using Xunit; -using System.Threading; -#if USE_MDT_EVENTSOURCE -using Microsoft.Diagnostics.Tracing; -#else using System.Diagnostics.Tracing; -#endif +using System.Threading; using SdtEventSources; +using Xunit; namespace BasicEventSourceTests { diff --git a/src/libraries/System.Diagnostics.Tracing/tests/CustomEventSources/EventSourceTest.cs b/src/libraries/System.Diagnostics.Tracing/tests/CustomEventSources/EventSourceTest.cs index 7a6734e33ca3d..1b2ea0c95047b 100644 --- a/src/libraries/System.Diagnostics.Tracing/tests/CustomEventSources/EventSourceTest.cs +++ b/src/libraries/System.Diagnostics.Tracing/tests/CustomEventSources/EventSourceTest.cs @@ -2,16 +2,9 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; -using System.Linq; using System.Diagnostics; -#if USE_MDT_EVENTSOURCE -using Microsoft.Diagnostics.Tracing; -#else using System.Diagnostics.Tracing; -#endif - -// We wish to test both Microsoft.Diagnostics.Tracing (Nuget) -// and System.Diagnostics.Tracing (Framework), we use this Ifdef make each kind +using System.Linq; namespace SdtEventSources { diff --git a/src/libraries/System.Diagnostics.Tracing/tests/CustomEventSources/InvalidCallsToWriteEvent.cs b/src/libraries/System.Diagnostics.Tracing/tests/CustomEventSources/InvalidCallsToWriteEvent.cs index 99d9a5bcf26a7..7bf6616573e01 100644 --- a/src/libraries/System.Diagnostics.Tracing/tests/CustomEventSources/InvalidCallsToWriteEvent.cs +++ b/src/libraries/System.Diagnostics.Tracing/tests/CustomEventSources/InvalidCallsToWriteEvent.cs @@ -1,15 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; -#if USE_MDT_EVENTSOURCE -using Microsoft.Diagnostics.Tracing; -#else using System.Diagnostics.Tracing; -#endif - -// We wish to test both Microsoft.Diagnostics.Tracing (Nuget) -// and System.Diagnostics.Tracing (Framework), we use this Ifdef make each kind namespace SdtEventSources { diff --git a/src/libraries/System.Diagnostics.Tracing/tests/CustomEventSources/InvalidEventSources.cs b/src/libraries/System.Diagnostics.Tracing/tests/CustomEventSources/InvalidEventSources.cs index 4d35db5b0fd9e..ec3513eeec484 100644 --- a/src/libraries/System.Diagnostics.Tracing/tests/CustomEventSources/InvalidEventSources.cs +++ b/src/libraries/System.Diagnostics.Tracing/tests/CustomEventSources/InvalidEventSources.cs @@ -1,15 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; -#if USE_MDT_EVENTSOURCE -using Microsoft.Diagnostics.Tracing; -#else using System.Diagnostics.Tracing; -#endif - -// We wish to test both Microsoft.Diagnostics.Tracing (Nuget) -// and System.Diagnostics.Tracing (Framework), we use this Ifdef make each kind namespace SdtEventSources { diff --git a/src/libraries/System.Diagnostics.Tracing/tests/CustomEventSources/SimpleEventSource.cs b/src/libraries/System.Diagnostics.Tracing/tests/CustomEventSources/SimpleEventSource.cs index da0403483c747..d807fd1fa6741 100644 --- a/src/libraries/System.Diagnostics.Tracing/tests/CustomEventSources/SimpleEventSource.cs +++ b/src/libraries/System.Diagnostics.Tracing/tests/CustomEventSources/SimpleEventSource.cs @@ -1,15 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; -#if USE_MDT_EVENTSOURCE -using Microsoft.Diagnostics.Tracing; -#else using System.Diagnostics.Tracing; -#endif - -// We wish to test both Microsoft.Diagnostics.Tracing (Nuget) -// and System.Diagnostics.Tracing (Framework), we use this Ifdef make each kind namespace SdtEventSources { @@ -17,12 +9,7 @@ namespace SdtEventSources // so we don't have to fully qualify everything else using it. namespace DontPollute { - public sealed class EventSource : -#if USE_MDT_EVENTSOURCE - Microsoft.Diagnostics.Tracing.EventSource -#else - System.Diagnostics.Tracing.EventSource -#endif + public sealed class EventSource : System.Diagnostics.Tracing.EventSource { [Event(1)] public void EventWrite(int i) { this.WriteEvent(1, i); } diff --git a/src/libraries/System.Diagnostics.Tracing/tests/CustomEventSources/UseAbstractEventSource.cs b/src/libraries/System.Diagnostics.Tracing/tests/CustomEventSources/UseAbstractEventSource.cs index d99ba5727b099..600c82bfeea06 100644 --- a/src/libraries/System.Diagnostics.Tracing/tests/CustomEventSources/UseAbstractEventSource.cs +++ b/src/libraries/System.Diagnostics.Tracing/tests/CustomEventSources/UseAbstractEventSource.cs @@ -2,15 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; - -#if USE_MDT_EVENTSOURCE -using Microsoft.Diagnostics.Tracing; -#else using System.Diagnostics.Tracing; -#endif - -// We wish to test both Microsoft.Diagnostics.Tracing (Nuget) -// and System.Diagnostics.Tracing (Framework), we use this Ifdef make each kind namespace SdtEventSources { diff --git a/src/libraries/System.Diagnostics.Tracing/tests/CustomEventSources/UseInterfaceEventSource.cs b/src/libraries/System.Diagnostics.Tracing/tests/CustomEventSources/UseInterfaceEventSource.cs index 6b5a837481702..f79294c6cf1ba 100644 --- a/src/libraries/System.Diagnostics.Tracing/tests/CustomEventSources/UseInterfaceEventSource.cs +++ b/src/libraries/System.Diagnostics.Tracing/tests/CustomEventSources/UseInterfaceEventSource.cs @@ -1,16 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; - -#if USE_MDT_EVENTSOURCE -using Microsoft.Diagnostics.Tracing; -#else using System.Diagnostics.Tracing; -#endif - -// We wish to test both Microsoft.Diagnostics.Tracing (Nuget) -// and System.Diagnostics.Tracing (Framework), we use this Ifdef make each kind namespace SdtEventSources { diff --git a/src/libraries/System.Diagnostics.Tracing/tests/System.Diagnostics.Tracing.Tests.csproj b/src/libraries/System.Diagnostics.Tracing/tests/System.Diagnostics.Tracing.Tests.csproj index 192e194dfa26b..af231d14fa72a 100644 --- a/src/libraries/System.Diagnostics.Tracing/tests/System.Diagnostics.Tracing.Tests.csproj +++ b/src/libraries/System.Diagnostics.Tracing/tests/System.Diagnostics.Tracing.Tests.csproj @@ -29,14 +29,12 @@ - - diff --git a/src/tests/tracing/eventcounter/eventcounter.cs b/src/tests/tracing/eventcounter/eventcounter.cs index 468ae575d78fd..e7190ac289d39 100644 --- a/src/tests/tracing/eventcounter/eventcounter.cs +++ b/src/tests/tracing/eventcounter/eventcounter.cs @@ -1,13 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#if USE_MDT_EVENTSOURCE -using Microsoft.Diagnostics.Tracing; -#else -using System.Diagnostics.Tracing; -#endif using System; using System.Collections.Generic; +using System.Diagnostics.Tracing; using System.Threading; using Xunit; diff --git a/src/tests/tracing/eventcounter/gh53564.cs b/src/tests/tracing/eventcounter/gh53564.cs index 9deea88fb676d..70566bac5c939 100644 --- a/src/tests/tracing/eventcounter/gh53564.cs +++ b/src/tests/tracing/eventcounter/gh53564.cs @@ -1,16 +1,12 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#if USE_MDT_EVENTSOURCE -using Microsoft.Diagnostics.Tracing; -#else -using System.Diagnostics.Tracing; -#endif using System; +using System.Diagnostics; +using System.Diagnostics.Tracing; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; -using System.Diagnostics; using Xunit; namespace gh53564Tests diff --git a/src/tests/tracing/eventcounter/incrementingeventcounter.cs b/src/tests/tracing/eventcounter/incrementingeventcounter.cs index 4cffe2db8b29d..63f859bf81f13 100644 --- a/src/tests/tracing/eventcounter/incrementingeventcounter.cs +++ b/src/tests/tracing/eventcounter/incrementingeventcounter.cs @@ -1,13 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#if USE_MDT_EVENTSOURCE -using Microsoft.Diagnostics.Tracing; -#else -using System.Diagnostics.Tracing; -#endif using System; using System.Collections.Generic; +using System.Diagnostics.Tracing; using System.Threading; using Xunit; diff --git a/src/tests/tracing/eventcounter/incrementingpollingcounter.cs b/src/tests/tracing/eventcounter/incrementingpollingcounter.cs index ba2f70a81ccf3..6ab839d698d2e 100644 --- a/src/tests/tracing/eventcounter/incrementingpollingcounter.cs +++ b/src/tests/tracing/eventcounter/incrementingpollingcounter.cs @@ -1,13 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#if USE_MDT_EVENTSOURCE -using Microsoft.Diagnostics.Tracing; -#else -using System.Diagnostics.Tracing; -#endif using System; using System.Collections.Generic; +using System.Diagnostics.Tracing; using System.Threading; using Xunit; diff --git a/src/tests/tracing/eventcounter/pollingcounter.cs b/src/tests/tracing/eventcounter/pollingcounter.cs index 85634dac786ae..2605694458f84 100644 --- a/src/tests/tracing/eventcounter/pollingcounter.cs +++ b/src/tests/tracing/eventcounter/pollingcounter.cs @@ -1,13 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#if USE_MDT_EVENTSOURCE -using Microsoft.Diagnostics.Tracing; -#else -using System.Diagnostics.Tracing; -#endif using System; using System.Collections.Generic; +using System.Diagnostics.Tracing; using System.Threading; using Xunit; diff --git a/src/tests/tracing/eventcounter/regression-25709.cs b/src/tests/tracing/eventcounter/regression-25709.cs index f226d81916e26..6c825c50096d4 100644 --- a/src/tests/tracing/eventcounter/regression-25709.cs +++ b/src/tests/tracing/eventcounter/regression-25709.cs @@ -1,16 +1,12 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#if USE_MDT_EVENTSOURCE -using Microsoft.Diagnostics.Tracing; -#else -using System.Diagnostics.Tracing; -#endif using System; using System.Collections.Generic; +using System.Diagnostics; +using System.Diagnostics.Tracing; using System.Threading; using System.Threading.Tasks; -using System.Diagnostics; using Xunit; namespace EventCounterRegressionTests diff --git a/src/tests/tracing/eventcounter/regression-46938.cs b/src/tests/tracing/eventcounter/regression-46938.cs index 6780d230f7a50..3d8cdf415ae87 100644 --- a/src/tests/tracing/eventcounter/regression-46938.cs +++ b/src/tests/tracing/eventcounter/regression-46938.cs @@ -1,16 +1,12 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#if USE_MDT_EVENTSOURCE -using Microsoft.Diagnostics.Tracing; -#else -using System.Diagnostics.Tracing; -#endif using System; using System.Collections.Generic; +using System.Diagnostics; +using System.Diagnostics.Tracing; using System.Threading; using System.Threading.Tasks; -using System.Diagnostics; using Xunit; namespace EventCounterRegressionTests diff --git a/src/tests/tracing/eventcounter/runtimecounters.cs b/src/tests/tracing/eventcounter/runtimecounters.cs index c89767a9fae18..1de0b8b4e2cf5 100644 --- a/src/tests/tracing/eventcounter/runtimecounters.cs +++ b/src/tests/tracing/eventcounter/runtimecounters.cs @@ -1,16 +1,12 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#if USE_MDT_EVENTSOURCE -using Microsoft.Diagnostics.Tracing; -#else -using System.Diagnostics.Tracing; -#endif using System; using System.Collections.Generic; +using System.Diagnostics; +using System.Diagnostics.Tracing; using System.Threading; using System.Threading.Tasks; -using System.Diagnostics; using Xunit; namespace RuntimeEventCounterTests diff --git a/src/tests/tracing/runtimeeventsource/RuntimeEventSourceTest.cs b/src/tests/tracing/runtimeeventsource/RuntimeEventSourceTest.cs index baca2592dc1f8..3407cabe93e86 100644 --- a/src/tests/tracing/runtimeeventsource/RuntimeEventSourceTest.cs +++ b/src/tests/tracing/runtimeeventsource/RuntimeEventSourceTest.cs @@ -1,16 +1,12 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#if USE_MDT_EVENTSOURCE -using Microsoft.Diagnostics.Tracing; -#else -using System.Diagnostics.Tracing; -#endif using System; using System.Collections.Generic; +using System.Diagnostics; +using System.Diagnostics.Tracing; using System.Threading; using System.Threading.Tasks; -using System.Diagnostics; AppContext.SetSwitch("appContextSwitch", true); AppDomain.CurrentDomain.SetData("appContextBoolData", true); // Not loggeed, bool key @@ -109,4 +105,4 @@ public bool Verify() } return true; } -} \ No newline at end of file +} From f7e63257dae9f05676441d8a4b1246532a5f9690 Mon Sep 17 00:00:00 2001 From: Stephen Toub Date: Mon, 22 Jul 2024 18:16:33 -0400 Subject: [PATCH 2/3] Put back and enable Test_Bad_WriteRelatedID_ParameterName test --- .../BasicEventSourceTest/TestsUserErrors.cs | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsUserErrors.cs b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsUserErrors.cs index b738b2f84c763..9fb7f0c088fbc 100644 --- a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsUserErrors.cs +++ b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsUserErrors.cs @@ -145,6 +145,34 @@ private void Test_Bad_EventSource_Startup(bool onStartup, Listener listener, Eve Assert.Equal(0, ea.Version); } } + + [Fact] + public void Test_Bad_WriteRelatedID_ParameterName() + { + Guid oldGuid; + Guid newGuid = Guid.NewGuid(); + Guid newGuid2 = Guid.NewGuid(); + EventSource.SetCurrentThreadActivityId(newGuid, out oldGuid); + + using (var bes = new BadEventSource_IncorrectWriteRelatedActivityIDFirstParameter()) + using (var listener = new EventListenerListener()) + { + var events = new List(); + listener.OnEvent = delegate (Event data) { events.Add(data); }; + + listener.EventSourceCommand(bes.Name, EventCommand.Enable); + + bes.RelatedActivity(newGuid2, "Hello", 42, "AA", "BB"); + + // Confirm that we get exactly one event from this whole process, that has the error message we expect. + Assert.Equal(1, events.Count); + Event _event = events[0]; + Assert.Equal("EventSourceMessage", _event.EventName); + string message = _event.PayloadString(0, "message"); + // expected message: "EventSource expects the first parameter of the Event method to be of type Guid and to be named "relatedActivityId" when calling WriteEventWithRelatedActivityId." + Assert.Contains("EventSource expects the first parameter of the Event method to be of type Guid and to be named \"relatedActivityId\" when calling WriteEventWithRelatedActivityId.", message); + } + } } /// @@ -159,6 +187,26 @@ public BadEventSource_MismatchedIds(EventSourceSettings settings) : base(setting public void Event2(int arg) { WriteEvent(1, arg); } } + public sealed class BadEventSource_IncorrectWriteRelatedActivityIDFirstParameter : EventSource + { + public void E2() + { + this.Write("sampleevent", new { a = "a string" }); + } + + [Event(7, Keywords = Keywords.Debug, Message = "Hello Message 7", Channel = EventChannel.Admin, Opcode = EventOpcode.Send)] + + public void RelatedActivity(Guid guid, string message, int value, string componentName, string instanceId) + { + WriteEventWithRelatedActivityId(7, guid, message, value, componentName, instanceId); + } + + public class Keywords + { + public const EventKeywords Debug = (EventKeywords)0x0002; + } + } + [EventData] public class UserClass { From 418fa9a5b2f105ff1fb6b17682223af93f01c066 Mon Sep 17 00:00:00 2001 From: Stephen Toub Date: Mon, 22 Jul 2024 23:04:34 -0400 Subject: [PATCH 3/3] Re-disable Test_Bad_WriteRelatedID_ParameterName test --- .../tests/BasicEventSourceTest/TestsUserErrors.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsUserErrors.cs b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsUserErrors.cs index 9fb7f0c088fbc..273b6b3e3670b 100644 --- a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsUserErrors.cs +++ b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsUserErrors.cs @@ -146,6 +146,7 @@ private void Test_Bad_EventSource_Startup(bool onStartup, Listener listener, Eve } } + [ActiveIssue("https://github.com/dotnet/runtime/issues/105293")] [Fact] public void Test_Bad_WriteRelatedID_ParameterName() {