Templates
Templates copied to clipboard
error when use .net 8 template with interactive render auto
Steps to reproduce error:
- install template with the command: dotnet new mudblazor --interactivity Auto
- run the proyect
- go to counter page
- click on counter button
- refresh the page
- get the error
@mikes-gh isn't the problem related because the template is using rc libs. I'm slightly surprised it went like this in prod
I did ask for them to be updated :-( ~~But thats not the problem in this case cause I updated them to 8.0.1 and the problem remains~~ edit it is the problem
@ScarletKuro You are right. After a clean and rebuild with 8.0.1 the issue is resolved
I had to also clean obj and bin folders
https://github.com/MudBlazor/Templates/issues/453#issuecomment-1901309111 This worked for me.
I am seeing the same error as initially described. Cleaning and rebuilding does not fix it for me. Also, I see it in every single, freshly created MudBlazor project. Here's what I did:
- In Visual Studio, I create a new project using the template "MudBlazor Web App (MudBlazor)", with .NET 8.0, no authentication and interactive render mode "Auto (Server and WebAssembly)", globally set:
Once it's created, I change nothing at all and start debugging (F5):
- After the first loading, it works: hiding/showing the sidebar, switching over to the counter page, increasing count by clicking the button.
- As soon as I reload or start the second debugging session (or each time after that), there's no interactivity any more (clicking the three-bars-symbol to hide the sidebar does nothing, neither does clicking the counter button), and a JSON error appears in the console:
(Also, the CSS file gets a 404 now).
-
Clicking the sidebar link "Counter" shows a lot of errors in the console:
-
This happens across all the browsers I've tried: Firefox, Brave, Edge. I've tried this in Visual Studio 2022 (17.8.6) as well as VS Code 1.86.0 - it's exactly same everywhere: First run after creating the project is okay, second and every after that fails.
-
My installed .NET SDK is 8.0.101.
-
MudBlazor templates installed are the latest (0.6.5).
-
I'm using Windows 11 Pro (23H2).
To rule out a configuration problem, I have uninstalled .NET entirely and made a clean install. I did the same with Visual Studio (removed completely and did a clean install). It changed nothing. I've used MudBlazor with .NET 6 and never experienced any problems like this.
Also, when using the "original" Blazor Web App template that comes with Visual Studio, applying the same settings as above, it works without a problem, no matter how often I reload / restart. The same goes for the Fluent UI template: It works both server side as well as after the switch to client side - so clearly, there's an issue with MudBlazor somehow...
My impression is that something goes/is wrong with the way WebAssembly render mode is configured/hooked in (since the problem occurs after the first reload, i.e. after the switch from server side to client side. Sadly, I cound't figure out what "the other" templates (the "original" one or Fluent UI) do differently regarding this...
I do think that MudBlazor is fantastic, and I'd really, really love to use this rather than Bootstrap (oiriginal template) or Fluent UI. So - how could this problem best be tackled?
Thanks to everybody investing tehir time to work on MudBlazor and to help other people!
@philipp-koch have you updated the underlying libraries (Microsoft.AspNetCore.Components.WebAssembly.Server
, Microsoft.AspNetCore.Components.WebAssembly
and all other MS libraries) to 8.0.1
as the issue suggests? Then clear obj
/ bin
/ .vs
(hidden) folders, clean browser cache etc.
@ScarletKuro Thank you for pointing this out so clearly - I was mistaken, thinking "8.0.1" referred to the installed .NET SDK! So, I've taken a look at the NuGet package manager, and indeed the mentioned packages were still the RC versions, not 8.0.1. I have updated them, performed clean and rebuild for the solution, cleared the browser cache - and voilà, it works now! So, in other words: "Amazing, just do it right and all of a sudden it works!" (Kaum macht man's richtig, schon funktioniert's...) 🤣
I'm a little embarassed now, but more importantly, I'm really happy this could be solved (so easily)...
Thanks for your quick and helpful reply!
Hopefully https://github.com/MudBlazor/Templates/pull/454 will be merged soon, so it will work out of the box.