I built and released an admin dashboard template for Blazor
**Blazor Web App .NET 10 gotchas I ran into building a dashboard from scratch**
Spent a few weekends building a Blazor Web App project to go deeper on the framework. Here are the things that tripped me up in case it saves someone else time.
**1. `@typeparam T` conflicts with the Razor source generator**
Using a single-letter generic like `T` causes a CS0305 error in the generated `.g.cs` file. Renaming to `TItem` fixes it. Not obvious from the error message.
**2. You cannot pass `RenderFragment` to an InteractiveServer component**
If you try to pass `@Body` or any `RenderFragment` parameter to a component with `@rendermode InteractiveServer`, you get a serialization error at runtime. Layouts must stay static — only leaf components can be interactive.
**3. `event Action?` on a singleton service is always null**
If you use a C# event on a singleton service to notify Blazor components, it stays null until something subscribes. But if the component hasn't rendered yet, nothing has subscribed. Use `List<Action>` with explicit Subscribe/Unsubscribe methods instead.
**4. `StateHasChanged` from a background thread**
When a singleton service calls back into a component from a Task or timer, you need `InvokeAsync(StateHasChanged)` — and `async void` is actually fine here for fire-and-forget callbacks.
**5. CSS variables and Bootstrap class conflicts**
Blazor templates ship with Bootstrap. Bootstrap defines `.toast`, `.modal` etc. with `display: none` — your custom components using the same class names will be hidden. Prefix your classes.
Built this into a full dashboard template (DataGrid, Charts, Toast, Modal, dark mode) if anyone wants to see the full implementation:
https://adminkit-demonstration-exg2ezcma0gfd0dq.francecentral-01.azurewebsites.net
Login: admin@demo.com / admin
Happy to share code snippets for any of these if useful.