diff --git a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/EventSourceTestParser.cs b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/EventSourceTestParser.cs index dd1550f4922ce..848d3dcac5a9d 100644 --- a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/EventSourceTestParser.cs +++ b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/EventSourceTestParser.cs @@ -328,17 +328,6 @@ // source.UnregisterEventTemplate(value, 30, ProviderGuid); // } // } -// public event Action LogTransferNoOpcode -// { -// add -// { -// source.RegisterEventTemplate(LogTransferNoOpcodeTemplate(value)); -// } -// remove -// { -// source.UnregisterEventTemplate(value, 28, ProviderGuid); -// } -// } // public event Action Message // { // add @@ -535,10 +524,6 @@ // { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName // return new EventWithWeirdArgsArgs(action, 30, 65504, "EventWithWeirdArgs", Guid.Empty, 0, "", ProviderGuid, ProviderName); // } -// private static EmptyTraceData LogTransferNoOpcodeTemplate(Action action) -// { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName -// return new EmptyTraceData(action, 28, 65506, "LogTransferNoOpcode", 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); @@ -577,7 +562,7 @@ // { // if (s_templates == null) // { -// var templates = new TraceEvent[35]; +// var templates = new TraceEvent[34]; // templates[0] = Event0Template(null); // templates[1] = EventITemplate(null); // templates[2] = EventIITemplate(null); @@ -605,14 +590,13 @@ // templates[24] = EventWithManyTypeArgsTemplate(null); // templates[25] = EventWith7StringsTemplate(null); // templates[26] = EventWith9StringsTemplate(null); -// templates[27] = LogTransferNoOpcodeTemplate(null); -// templates[28] = WorkManyArgsSendTemplate(null); -// templates[29] = EventWithWeirdArgsTemplate(null); -// templates[30] = WorkWeirdArgsSendTemplate(null); -// templates[31] = EventWithEscapingMessageTemplate(null); -// templates[32] = EventWithMoreEscapingMessageTemplate(null); -// templates[33] = EventWithByteArrArgTemplate(null); -// templates[34] = EventWithBytePtrArgTemplate(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) 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 0ebe93c8ca729..e0a1163bd409b 100644 --- a/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsWriteEventToListener.Etw.cs +++ b/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsWriteEventToListener.Etw.cs @@ -68,9 +68,6 @@ public void Test_WriteEvent_TransferEvents() Assert.True((bool)LoudListener.LastEvent.Payload[1]); Assert.Equal(MyLongEnum.LongVal1, (MyLongEnum)LoudListener.LastEvent.Payload[2]); // Assert.Equal(9999999999999999999999999999m, (decimal)LoudListener.LastEvent.Payload[3]); - - actid = Guid.NewGuid(); - Assert.Throws(() => log.LogTransferNoOpcode(actid)); } } TestUtilities.CheckNoEventSourcesRunning("Stop"); diff --git a/src/libraries/System.Diagnostics.Tracing/tests/CustomEventSources/EventSourceTest.cs b/src/libraries/System.Diagnostics.Tracing/tests/CustomEventSources/EventSourceTest.cs index ce8c66001f990..b371ba67e67e1 100644 --- a/src/libraries/System.Diagnostics.Tracing/tests/CustomEventSources/EventSourceTest.cs +++ b/src/libraries/System.Diagnostics.Tracing/tests/CustomEventSources/EventSourceTest.cs @@ -156,15 +156,6 @@ public void EventWith7Strings(string s0, string s1, string s2, string s3, string public void EventWith9Strings(string s0, string s1, string s2, string s3, string s4, string s5, string s6, string s7, string s8) { WriteEvent(27, s0, s1, s2, s3, s4, s5, s6, s7, s8); } - [Event(28, Keywords = Keywords.Transfer | Keywords.HasNoArgs)] - public void LogTransferNoOpcode(Guid RelatedActivityId) - { - unsafe - { - WriteEventWithRelatedActivityIdCore(28, &RelatedActivityId, 0, null); - } - } - [Event(29, Keywords = Keywords.Transfer | Keywords.HasNoArgs, Level = EventLevel.Informational, Opcode = EventOpcode.Send, Task = Tasks.WorkManyArgs)] public void EventWithXferManyTypeArgs(Guid RelatedActivityId, long l, uint ui, ulong ui64, char ch, byte b, sbyte sb, short sh, ushort ush, diff --git a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs index fa21262c34d15..03299a776d3c9 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs @@ -1195,9 +1195,6 @@ protected unsafe void WriteEventWithRelatedActivityIdCore(int eventId, Guid* rel Debug.Assert(m_eventData != null); // You must have initialized this if you enabled the source. try { - if (relatedActivityId != null) - ValidateEventOpcodeForTransfer(ref m_eventData[eventId], m_eventData[eventId].Name); - EventOpcode opcode = (EventOpcode)m_eventData[eventId].Descriptor.Opcode; EventActivityOptions activityOptions = m_eventData[eventId].ActivityOptions; Guid* pActivityId = null; @@ -1870,8 +1867,6 @@ private unsafe void WriteEventVarargs(int eventId, Guid* childActivityID, object { if (childActivityID != null) { - ValidateEventOpcodeForTransfer(ref m_eventData[eventId], m_eventData[eventId].Name); - // If you use WriteEventWithRelatedActivityID you MUST declare the first argument to be a GUID // with the name 'relatedActivityID, and NOT pass this argument to the WriteEvent method. // During manifest creation we modify the ParameterInfo[] that we store to strip out any @@ -2337,16 +2332,6 @@ private void ThrowEventSourceException(string? eventName, Exception? innerEx = n } } - private void ValidateEventOpcodeForTransfer(ref EventMetadata eventData, string? eventName) - { - if ((EventOpcode)eventData.Descriptor.Opcode != EventOpcode.Send && - (EventOpcode)eventData.Descriptor.Opcode != EventOpcode.Receive && - (EventOpcode)eventData.Descriptor.Opcode != EventOpcode.Start) - { - ThrowEventSourceException(eventName); - } - } - internal static EventOpcode GetOpcodeWithDefault(EventOpcode opcode, string? eventName) { if (opcode == EventOpcode.Info && eventName != null)