Skip to content

fix(blazor): remove the async pending race and gate every configuration - #68

Merged
kieronlanning merged 3 commits into
mainfrom
fix/blazor-async-pending-and-all-config-tests
Nov 11, 2026
Merged

kieronlanning merged 3 commits into
mainfrom
fix/blazor-async-pending-and-all-config-tests

Conversation

@kieronlanning

Copy link
Copy Markdown
Collaborator

Summary

Fixes the release failure in run 43066439932 and closes the coverage gap that let it reach main.

1. The failing test was a race

DataAnnotationsValidator_GivenAsyncOnlyMemberFieldChange_IsPendingThenShowsTheError sampled editContext.IsValidationPending(field) after await form.InvokeAsync(...) returned. The async field validation suspends at Task.Yield() and queues its continuation on the renderer's dispatcher, so on the faster Release/Linux run the continuation resolved and cleared pending before the test thread resumed. The test now reads the state inside the same dispatcher work item, where the continuation is still queued, making the assertion deterministic rather than timing-dependent.

PackModule failed only because it depends on RunTestsModule.

2. Every configuration is now gated

The shared pipeline runs a single configuration (Release). Debug - what just test uses locally - was never exercised in CI.

  • Added a pr.yml debug job that builds the whole solution and runs every test in Debug.
  • Kept run-tests: true explicit on the Release gate.
  • Added ReleaseGateTests.PrWorkflow_GivenTheTestGates_RunsEveryTestInBothConfigurations so neither gate can be silently removed.
  • Pinned build-version: 0.9.0 (matching .config/dotnet-tools.json) in pr.yml and release.yml, which also clears the "Unpinned build tool" warning.
  • Updated docs/wiki/development/Release-Flow.md.

Verification

  • Full solution build: Debug and Release, 0 warnings / 0 errors.
  • Full test suite: 4511 passed, 0 failed in both Debug and Release (all TFMs).
  • dotnet csharpier check .: clean (703 files).
  • just pipeline-pr (the failing pipeline): 9 modules passed, PackValidation 16/16 packages valid.

The async field validation suspends at its first await and queues its continuation on the renderer's dispatcher. Sampling IsValidationPending after the InvokeAsync call returned raced that continuation: on the Release Linux runner it resolved first, so the test asserted False. Read the state inside the same dispatcher work item, where the continuation cannot run yet.
The shared pipeline runs a single configuration (Release), so Debug - the configuration just test uses locally - was never exercised in CI. Add a Debug job that builds the solution and runs every test, keep run-tests explicit on the Release gate, and guard both with ReleaseGateTests. Pin build-version to the 0.9.0 in .config/dotnet-tools.json so CI runs what local runs and stops warning about an unpinned tool.
@kieronlanning
kieronlanning merged commit d00c914 into main Nov 11, 2026
8 checks passed
@kieronlanning
kieronlanning deleted the fix/blazor-async-pending-and-all-config-tests branch November 11, 2026 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant