Skip to content

fix: stabilize ASP.NET Core test logger initialization - #4571

Merged
iancooper merged 2 commits into
BrighterCommand:masterfrom
gabisonia:fix/4565-aspnetcore-test-logger
Oct 11, 2026
Merged

iancooper merged 2 commits into
BrighterCommand:masterfrom
gabisonia:fix/4565-aspnetcore-test-logger

Conversation

@gabisonia

Copy link
Copy Markdown
Member

Description

Parallel ASP.NET Core tests can initialize a Brighter logger after another test host has disposed the shared logger factory. Warm the missing inbox handlers, pipeline builders and transform lifetime scope in the module initializer so their static loggers bind to the stable test factory.

The three SQLite transaction tests also create outbox loggers per instance. Put those tests in a non-parallel collection so their existing factory reset is safe during outbox construction. Other test classes remain parallel.

Related Issues

Fixes #4565

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the Contributing Guide
  • I have checked the documentation for relevant guidance — not applicable to this test infrastructure fix
  • I have added/updated XML documentation for any public API changes — no production API changes; test helper documentation updated
  • I have added/updated tests as appropriate
  • My changes follow the existing code style and conventions

Additional Notes

  • Reproduced five failing tests on each framework before the fix. Longer runs also exposed the transform-scope initialization failure and the SQLite instance-logger race addressed here.
  • Release build passed for .NET 9 and .NET 10.
  • Final validation: 20 fresh-process runs of the full 65-test suite per framework; all 2,600 test executions passed with no skips.
  • TRX timings confirmed SQLite tests did not overlap other tests in any run, while the other test classes still ran in parallel in all 40 runs.

Please merge with a merge commit, per the contributing guide.

Warm the missing inbox, pipeline builder and transform scope loggers before test hosts can dispose their factories. Isolate SQLite transaction tests so per-instance outbox loggers use a live factory.

Fixes BrighterCommand#4565. Validated with 20 full suite runs per framework on .NET 9 and .NET 10 (2,600 passing test executions).
@iancooper

Copy link
Copy Markdown
Member

Thanks @gabisonia

@iancooper
iancooper merged commit c98bd40 into BrighterCommand:master Oct 11, 2026
32 of 34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3 - Done Bug .NET Pull requests that update .net code V10.X

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extensions.AspNetCore.Tests: flaky ObjectDisposedException from UseInboxHandler<T> static logger

2 participants