After clicking on a mail link the website is crashing:
Error: Circuit has been shut down due to error.
Create new Blazor server project
Create Email link in Page index.razor: <a href="mailto:test@localhost">mail</a>
Start Project and click on E-Mail Link
Click on menu -> Crash:
Error: Circuit has been shut down due to error.
dotnet sdk 3.1.402
Thanks for contacting us.
Can you please share the full exception message from the server?
Thanks for contacting us.
We're moving this issue to the Next sprint planning milestone for future evaluation / consideration. We will evaluate the request when we are planning the work for the next milestone. To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.
Thank you for your reply - Error messages I get:
WebSite: An unhandled exception has occurred. See browser dev tools for details. Reload
Browser Dev Tools: blazor.server.js:19 [2020-09-09T17:36:54.145Z] Error: Circuit has been shut down due to error.
e.log @ blazor.server.js:19
No error server side.
Could this be somewhat related to: #25646 ?
Same error message and doing a navigation outside the blazor router
@vertonghenb yes, sounds similar - same error with NavManager.NavigateTo("mailto:test@localhost") or NavManager.NavigateTo("tel:12345")
I am working with dotnet 5 preview 8, but I tested it with stable to see if it is a preview thing and getting the same error with the latest dotnet 3.1
Additional Info:
It is working fine on the latest Firefox (80.0.1 (64-Bit)) - for dotnet 5 preview 8 and dotnet 3.1
Crash is happening on Chrome (Version 85.0.4183.102 (64-Bit)) and Microsoft Edge (Version 85.0.564.51 (64-Bit))
I'm trying this with a download MVC controller and it does the same thing. Any call to NavManager.NavigateTo(url, true); breaks the SignlalR circuit immediately afterwards. This is happening on FireFox 80.0.1 64bit for me as well. The behavior is slightly different on FireFox in that it appears to immediately break the circuit, whereas with Chrome everything seems fine until I interact with the page and then it reports that the circuit is broken. As with the OP, I get no server side errors, and just a browser dev tools error saying "Error: Circuit has been shut down due to error."
The only alternative to using NavigationManager that I can come up with is using JS Interop, which is ugly. File downloads basically have to be done by opening up a popup window (which FireFox hates). This is quite a serious issue and seems like it only cropped up with a recent .NET Core update.
Looks like mailto and tel links trigger the beforeunload event which causes Blazor to clean up circuit state. Until we resolve this, using https://stackoverflow.com/a/29016818 seems like a really neat workaround. https://stackoverflow.com/a/58860333 has some suggestions on how to address this in our beforeunload event handler.
This is occurring on any usage of NavigationManager.NavigateTo("url/goes/here", true) in addition to mailto and tel links. I'm seening this myself on an environment running the latest .NET Core 3.1 runtimes, as well as many others as detailed in https://github.com/dotnet/aspnetcore/issues/25646.
From comparing an environment that is running older .NET Core 3.1 runtimes to one that has the latest, the issue seems to be in "blazor.server.js", and as far as I can tell, the following push https://github.com/dotnet/aspnetcore/pull/23224 is why this issue started happening.
FYI @captainsafia. @Daeymon NavigateTo with forceLoad: true should reload the page re-establishing a new circuit if it navigates to a Blazor app. Can you please file a separate issue with a minimal repro of the issue and we can determine if the two are resolved by the same fix?
Thanks for contacting us.
We're moving this issue to the Next sprint planning milestone for future evaluation / consideration. We will evaluate the request when we are planning the work for the next milestone. To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.
FYI @pranavkm, @wondering639 has already reported and done a minimal repro for reproducing the NavigateTo issue, https://github.com/dotnet/aspnetcore/issues/25646.
Thanks @Daeymon that helps. We clearly missed some of these scenarios when patching 3.1 and have the same behavior in 5.0. We're planning to discuss how to remedy this issue soon.
Add target="_blank" to the anchor tag to prevent this error