dotnet / dotnet/aspnetcore

[Known Build Error] `NavigationException_InAsyncContext_DoesNotBecomeUnobservedTaskException` fails with `ObjectDisposedException`

Open
#62,672 5 comments 0 reactions 0 assignees View on GitHub
area-blazor Known Build Error
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

The test should not be quarantined, it's under observation. It has a PR that tries to fix it and requires more investigation: https://github.com/dotnet/aspnetcore/pull/62662.

## Build Information
Build: https://dev.azure.com/dnceng-public/public/_build/results?buildId=1090989
Build error leg or test failing: Microsoft.AspNetCore.Components.E2ETests.ServerRenderingTests.RedirectionTest.NavigationException_InAsyncContext_DoesNotBecomeUnobservedTaskException
Pull request: https://github.com/dotnet/aspnetcore/pull/62602

## Error Message

Fill the error message using [step by step known issues guidance](https://github.com/dotnet/arcade/blob/main/Documentation/Projects/Build%20Analysis/KnownIssueJsonStepByStep.md).

```json
{
"ErrorMessage": "A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread.",
"ErrorPattern": "",
"BuildRetry": false,
"ExcludeConsoleLog": false
}
```

```

Hello, world!

4

Unobserved Exceptions (for debugging):


  • System.AggregateException: A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread. (Cannot access a disposed object.
    Object name: 'IServiceProvider'.)
    ---> System.ObjectDisposedException: Cannot access a disposed object.
    Object name: 'IServiceProvider'.
    at Microsoft.Extensions.DependencyInjection.ServiceLookup.ThrowHelper.ThrowObjectDisposedException()
    at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
    at Microsoft.AspNetCore.Components.Server.Circuits.CircuitPersistenceManager.PauseCircuitAsync(CircuitHost circuit, Boolean saveStateToClient, CancellationToken cancellation) in /home/vsts/work/1/s/src/Components/Server/src/Circuits/CircuitPersistenceManager.cs:line 25
    at Microsoft.AspNetCore.Components.Server.Circuits.CircuitRegistry.PauseAndDisposeCircuitHost(CircuitHost circuitHost, Boolean saveStateToClient) in /home/vsts/work/1/s/src/Components/Server/src/Circuits/CircuitRegistry.cs:line 312
    --- End of inner exception stack trace ---

  • ```

    ### Known issue validation
    **Build: :mag_right:** https://dev.azure.com/dnceng-public/public/_build/results?buildId=1090989
    **Error message validated:** `[A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread.`]
    **Result validation:** :white_check_mark: Known issue matched with the provided build.
    **Validation performed at:** 7/11/2025 10:21:55 AM UTC

    ### Report
    #### Summary
    |24-Hour Hit Count|7-Day Hit Count|1-Month Count|
    |---|---|---|
    |0|0|0|

Contributor guide

Open the contributing guide

Research direction

Start with the failing Microsoft.AspNetCore.Components.E2ETests.ServerRenderingTests.RedirectionTest.NavigationException_InAsyncContext_DoesNotBecomeUnobservedTaskException test and review PRs 62662 and 62602. Trace the reported ObjectDisposedException through CircuitPersistenceManager.cs and CircuitRegistry.cs, then verify the build no longer reports the unobserved exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.