diff --git a/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http3/Http3StreamTests.cs b/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http3/Http3StreamTests.cs index a7fce40ae41f..580a41392b53 100644 --- a/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http3/Http3StreamTests.cs +++ b/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http3/Http3StreamTests.cs @@ -1685,6 +1685,10 @@ public async Task FrameAfterTrailers_UnexpectedFrameError() var requestStream = await InitializeConnectionAndStreamsAsync(_noopApplication); await requestStream.SendHeadersAsync(headers, endStream: false); + + // The app no-ops quickly. Wait for it here so it's not a race with the error response. + await requestStream.ExpectHeadersAsync(); + await requestStream.SendDataAsync(Encoding.UTF8.GetBytes("Hello world")); await requestStream.SendHeadersAsync(trailers, endStream: false); await requestStream.SendDataAsync(Encoding.UTF8.GetBytes("This is invalid."));