Skip to content

Commit 984a5c4

Browse files
committed
- Include Mono MacCatalyst testing
- Wait for event processing before disconnecting the EventPipe stream
1 parent 061cbaa commit 984a5c4

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

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

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,22 @@ public override void Dispose()
110110
{
111111
return;
112112
}
113-
_disposed = true;
114-
_session?.Stop();
115-
_session?.Dispose();
116113

117-
if (_processingTask != null && !_processingTask.Wait(TimeSpan.FromSeconds(5)))
114+
try
118115
{
119-
Debug.WriteLine("EventPipeEventListener processing task failed to stop in a timely manner.");
116+
_disposed = true;
117+
_session?.Stop();
118+
119+
if (_processingTask != null && !_processingTask.Wait(TimeSpan.FromSeconds(5)))
120+
{
121+
// If the session is still streaming data then session.Dispose() below will disconnect the stream
122+
// and likely cause the thread running source.Process() to throw.
123+
Assert.Fail("EventPipeEventListener processing task failed to complete in 5 seconds.");
124+
}
125+
}
126+
finally
127+
{
128+
_session?.Dispose();
120129
}
121130
}
122131

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ private struct PartB_UserInfo
2929
public static TheoryData<Listener> GetListeners()
3030
{
3131
TheoryData<Listener> data = new TheoryData<Listener>();
32-
if (PlatformDetection.IsNetCore && PlatformDetection.IsNotAndroid && PlatformDetection.IsNotBrowser && PlatformDetection.IsNotMonoRuntime)
32+
33+
if (PlatformDetection.IsNetCore && PlatformDetection.IsNotAndroid && PlatformDetection.IsNotBrowser &&
34+
(PlatformDetection.IsNotMonoRuntime || PlatformDetection.IsMacCatalyst))
3335
{
3436
data.Add(new EventPipeListener());
3537
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ public static TheoryData<Listener,bool> GetListenerConfigurations()
3030
public static TheoryData<Listener> GetListeners()
3131
{
3232
TheoryData<Listener> data = new TheoryData<Listener>();
33-
if (PlatformDetection.IsNetCore && PlatformDetection.IsNotAndroid && PlatformDetection.IsNotBrowser && PlatformDetection.IsNotMonoRuntime)
33+
if (PlatformDetection.IsNetCore && PlatformDetection.IsNotAndroid && PlatformDetection.IsNotBrowser &&
34+
(PlatformDetection.IsNotMonoRuntime || PlatformDetection.IsMacCatalyst))
3435
{
3536
data.Add(new EventPipeListener());
3637
}

0 commit comments

Comments
 (0)