(BlazorServer) each navigation to external logs 2 errors a minute later
See original GitHub issueIs there an existing issue for this?
- I have searched the existing issues
Describe the bug
Each time you leave the blazor circuit a minute later two exceptions are logged.
Expected Behavior
zero errors in log when no one does wrong things.
Steps To Reproduce
Run original sample created by dotnet.exe new blazorserver --name BlazorServerTemplate --output . -f net7.0 --auth Individual --use-program-main
On top right click on “Login” which is <a href="Identity/Account/Login">Log in</a> in LoginDisplay.razor.
Wait a minute (or maybe 2) then 2 errors are logged to console (or external logging apps like SEQ):
fail: Microsoft.AspNetCore.Components.Server.Circuits.RemoteNavigationManager[4]
Navigation failed when changing the location to https://localhost:7206/Identity/Account/Login?returnUrl=~/counter
System.Threading.Tasks.TaskCanceledException: A task was canceled.
at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args)
at Microsoft.JSInterop.JSRuntimeExtensions.InvokeVoidAsync(IJSRuntime jsRuntime, String identifier, Object[] args)
at Microsoft.AspNetCore.Components.Server.Circuits.RemoteNavigationManager.<>c__DisplayClass13_0.<<NavigateToCore>g__PerformNavigationAsync|0>d.MoveNext()
fail: Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost[111]
Unhandled exception in circuit 'XaCjYqsnL_QC9xVVeKm9IEojYbj1uBcoSgjuyHwtR7U'.
System.Threading.Tasks.TaskCanceledException: A task was canceled.
at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args)
at Microsoft.JSInterop.JSRuntimeExtensions.InvokeVoidAsync(IJSRuntime jsRuntime, String identifier, Object[] args)
at Microsoft.AspNetCore.Components.Server.Circuits.RemoteNavigationManager.<>c__DisplayClass13_0.<<NavigateToCore>g__PerformNavigationAsync|0>d.MoveNext()
Exceptions (if any)
TaskCancelledException
.NET Version
7.0.0
Issue Analytics
- State:
- Created 10 months ago
- Reactions:4
- Comments:13 (1 by maintainers)
Top Results From Across the Web
Handle errors in ASP.NET Core Blazor apps
This article describes how Blazor manages unhandled exceptions and how to develop apps that detect and handle errors.
Read more >c# - How to disable "Attempting to reconnect to the server" ...
Blazor server retains old in-memory client circuits for a default of 3 minutes, which are then torn down, and a 1 minute timeout...
Read more >Blazor Best Practices: Handling Errors
Errors are likely to occur, the question is how to handle them. Let's take a look at best practices in handling them in...
Read more >How to Build and Secure Web Applications with Blazor
Learn how to build client-side Web apps using Blazor and how to secure them with Auth0 authentication and authorization features.
Read more >Adding authentication to a Blazor Server app using Auth0
In this post I show how to add authentication to a Blazor Server ... Using an external identity provider (such as Auth0) is...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@springy76 Sorry, yea you totally write. I was to impatient with intellisense 🙉 it’s like in your example but with context instead of content.
@Schtailian just a side note regarding your code snippet: Do not use the
Resultproperty of Tasks to “await” a task, all sorts of deadlocks might happen using such code. TheNotAuthorizedrenderfragment already transports the awaitedAuthenticationStateby context variable, just pass it around: