Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public void TestEnableRaiseEvents(bool? enable)
[InlineData(true)]
public void TestExited_SynchronizingObject(bool invokeRequired)
{
bool exitedInvoked = false;
var mres = new ManualResetEventSlim();
Task beginInvokeTask = null;

Process p = CreateProcessLong();
Expand All @@ -154,20 +154,20 @@ public void TestExited_SynchronizingObject(bool invokeRequired)
}
};
p.EnableRaisingEvents = true;
p.Exited += delegate { exitedInvoked = true; };
p.Exited += delegate { mres.Set(); };
StartSleepKillWait(p);

Assert.True(mres.Wait(WaitInMS));

if (invokeRequired)
{
Assert.NotNull(beginInvokeTask);
beginInvokeTask.Wait();
Assert.True(beginInvokeTask.Wait(WaitInMS));
}
else
{
Assert.Null(beginInvokeTask);
}

Assert.True(exitedInvoked);
}

[Fact]
Expand Down