Skip to content

Commit

Permalink
Update WaiterRemovedAfterDispose to check waitersCount first (#5646)
Browse files Browse the repository at this point in the history
Co-authored-by: EUROPE\alechniak <alechniak@microsoft.com>
  • Loading branch information
amadeuszl and alechniak authored Nov 16, 2024
1 parent 09094ae commit 7c39837
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -226,15 +226,18 @@ public void WaiterRemovedAfterDispose()

timer1.Dispose();

var waitersCountAfterDispose = timeProvider.Waiters.Count;

timeProvider.Advance(TimeSpan.FromMilliseconds(1));

var waitersCountAfter = timeProvider.Waiters.Count;
var waitersCountOnFinish = timeProvider.Waiters.Count;

Assert.Equal(0, waitersCountStart);
Assert.Equal(2, waitersCountDuring);
Assert.Equal(1, waitersCountAfterDispose);
Assert.Equal(1, waitersCountOnFinish);
Assert.Equal(1, timer1Counter);
Assert.Equal(2, timer2Counter);
Assert.Equal(1, waitersCountAfter);
}

#if RELEASE // In Release only since this might not work if the timer reference being tracked by the debugger
Expand Down

0 comments on commit 7c39837

Please sign in to comment.