From 265ed6dce47b97e81fee7e51dda1d5e084ea51f0 Mon Sep 17 00:00:00 2001 From: Jakob Botsch Nielsen Date: Thu, 14 Aug 2025 17:18:40 +0200 Subject: [PATCH] Disable async test assert with race condition --- .../synchronization-context/synchronization-context.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/tests/async/synchronization-context/synchronization-context.cs b/src/tests/async/synchronization-context/synchronization-context.cs index e3a5e2eed606b4..d1b053cd7ebf0a 100644 --- a/src/tests/async/synchronization-context/synchronization-context.cs +++ b/src/tests/async/synchronization-context/synchronization-context.cs @@ -40,8 +40,11 @@ private static async Task TestSyncContextContinueAsync() await WrappedYieldToThreadPool(suspend: false).ConfigureAwait(false); Assert.Same(context, SynchronizationContext.Current); - await WrappedYieldToThreadPool(suspend: true).ConfigureAwait(false); - Assert.Null(SynchronizationContext.Current); + // Currently disabled since ConfigureAwait does not become a runtime async call, + // and this has a race condition until it does (where the callee finishes before + // we check IsCompleted on the awaiter). + //await WrappedYieldToThreadPool(suspend: true).ConfigureAwait(false); + //Assert.Null(SynchronizationContext.Current); await WrappedYieldToThreadWithCustomSyncContext(); Assert.Null(SynchronizationContext.Current);