Skip to content

Commit e83aebc

Browse files
committed
Feedback + disabling platforms where EventPipe can't loopback
1 parent 4c2b655 commit e83aebc

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/Harness/EventPipeListener.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ public EventPipeListener() { }
3939
public override void EventSourceCommand(string eventSourceName, EventCommand command, FilteringOptions options = null)
4040
{
4141
if (eventSourceName is null)
42+
{
4243
throw new ArgumentNullException(nameof(eventSourceName));
44+
}
4345

4446
if (_session != null)
4547
{
@@ -51,7 +53,9 @@ public override void EventSourceCommand(string eventSourceName, EventCommand com
5153
public override void Start()
5254
{
5355
if (_session != null)
56+
{
5457
return; // already started
58+
}
5559

5660
// Build provider enable list from pending commands
5761
foreach (var (eventSourceName, command, options) in _pendingCommands)
@@ -91,7 +95,9 @@ private void ProcessEvents(EventPipeSession session)
9195
{
9296
// EventPipe adds extra events we didn't ask for, ignore them.
9397
if (traceEvent.ProviderName == "Microsoft-DotNETCore-EventPipe")
98+
{
9499
return;
100+
}
95101

96102
OnEvent?.Invoke(new EventPipeEvent(traceEvent));
97103
};
@@ -101,7 +107,9 @@ private void ProcessEvents(EventPipeSession session)
101107
public override void Dispose()
102108
{
103109
if (_disposed)
110+
{
104111
return;
112+
}
105113
_disposed = true;
106114
_session?.Stop();
107115
_session?.Dispose();
@@ -152,7 +160,9 @@ public EventPipeEvent(TraceEvent data)
152160
public override object PayloadValue(int propertyIndex, string propertyName)
153161
{
154162
if (propertyName != null)
163+
{
155164
Assert.Equal(propertyName, _payloadNames[propertyIndex]);
165+
}
156166
return _payloadValues[propertyIndex];
157167
}
158168
}

src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/Harness/Listeners.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public abstract class Listener : IDisposable
5151

5252
public void EventSourceSynchronousEnable(EventSource eventSource, FilteringOptions options = null)
5353
{
54-
if(!IsDynamicConfigChangeSupported)
54+
if (!IsDynamicConfigChangeSupported)
5555
{
5656
throw new InvalidOperationException("This listener does not support dynamic config changes");
5757
}

src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsWrite.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ private struct PartB_UserInfo
2929
public static TheoryData<Listener> GetListeners()
3030
{
3131
TheoryData<Listener> data = new TheoryData<Listener>();
32-
if (PlatformDetection.IsNetCore)
32+
if (PlatformDetection.IsNetCore && PlatformDetection.IsNotAndroid && PlatformDetection.IsNotBrowser && PlatformDetection.IsNotMonoRuntime)
3333
{
3434
data.Add(new EventPipeListener());
3535
}

src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsWriteEvent.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public static TheoryData<Listener,bool> GetListenerConfigurations()
3030
public static TheoryData<Listener> GetListeners()
3131
{
3232
TheoryData<Listener> data = new TheoryData<Listener>();
33-
if(PlatformDetection.IsNetCore)
33+
if (PlatformDetection.IsNetCore && PlatformDetection.IsNotAndroid && PlatformDetection.IsNotBrowser && PlatformDetection.IsNotMonoRuntime)
3434
{
3535
data.Add(new EventPipeListener());
3636
}
@@ -380,7 +380,6 @@ private void Test_WriteEvent_Helper(Listener listener, bool useSelfDescribingEve
380380

381381
/**********************************************************************/
382382

383-
384383
[Theory]
385384
[MemberData(nameof(GetListeners))]
386385
public void Test_WriteEvent_ComplexData_SelfDescribing(Listener listener)

0 commit comments

Comments
 (0)