Skip to content

Commit 0c97d79

Browse files
committed
Fix GC tests
1 parent 8672ce2 commit 0c97d79

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

test/StreamJsonRpc.Tests/AsyncEnumerableTests.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,7 @@ public async Task NotifyAsync_ThrowsIfAsyncEnumerableSent()
456456
public async Task ArgumentEnumerable_ReleasedOnErrorResponse()
457457
{
458458
WeakReference enumerable = await this.ArgumentEnumerable_ReleasedOnErrorResponse_Helper();
459+
await Task.Yield(); // get off the helper's inline continuation stack.
459460
AssertCollectedObject(enumerable);
460461
}
461462

@@ -465,6 +466,7 @@ public async Task ArgumentEnumerable_ReleasedOnErrorResponse()
465466
public async Task ArgumentEnumerable_ReleasedOnErrorInSubsequentArgumentSerialization()
466467
{
467468
WeakReference enumerable = await this.ArgumentEnumerable_ReleasedOnErrorInSubsequentArgumentSerialization_Helper();
469+
await Task.Yield(); // get off the helper's inline continuation stack.
468470
AssertCollectedObject(enumerable);
469471
}
470472

@@ -474,6 +476,7 @@ public async Task ArgumentEnumerable_ReleasedOnErrorInSubsequentArgumentSerializ
474476
public async Task ArgumentEnumerable_ReleasedWhenIgnoredBySuccessfulRpcCall()
475477
{
476478
WeakReference enumerable = await this.ArgumentEnumerable_ReleasedWhenIgnoredBySuccessfulRpcCall_Helper();
479+
await Task.Yield(); // get off the helper's inline continuation stack.
477480
AssertCollectedObject(enumerable);
478481
}
479482

@@ -483,6 +486,7 @@ public async Task ArgumentEnumerable_ReleasedWhenIgnoredBySuccessfulRpcCall()
483486
public async Task ArgumentEnumerable_ForciblyDisposedAndReleasedWhenNotDisposedWithinRpcCall()
484487
{
485488
WeakReference enumerable = await this.ArgumentEnumerable_ForciblyDisposedAndReleasedWhenNotDisposedWithinRpcCall_Helper();
489+
await Task.Yield(); // get off the helper's inline continuation stack.
486490
AssertCollectedObject(enumerable);
487491

488492
// Assert that if the RPC server tries to enumerate more values after it returns that it gets the right exception.
@@ -495,6 +499,7 @@ public async Task ArgumentEnumerable_ForciblyDisposedAndReleasedWhenNotDisposedW
495499
public async Task ReturnEnumerable_AutomaticallyReleasedOnErrorFromIteratorMethod()
496500
{
497501
WeakReference enumerable = await this.ReturnEnumerable_AutomaticallyReleasedOnErrorFromIteratorMethod_Helper();
502+
await Task.Yield(); // get off the helper's inline continuation stack.
498503
AssertCollectedObject(enumerable);
499504
}
500505

0 commit comments

Comments
 (0)