-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Open
Labels
Needs: Author FeedbackThe author of this issue needs to respond in order for us to continue investigating this issue.The author of this issue needs to respond in order for us to continue investigating this issue.area-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor Components
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
The CSS bundle appears to exist and load, but the browser does not apply the styles. If the same rules are applied to an inline style or a global stylesheet (site.css), the styles work.
This setup worked earlier in the same project and stopped working while fixing other bugs. I have not been able to restore the previous behaviour. When creating a new project, they will work as well.
Environment
- .NET: 10.0 (Blazor United style project)
- Rendering: Interactive server
- Browser: Microsoft Edge (and others, same result)
- Project: Blazor app with isolated CSS (Component.razor + Component.razor.css)
Program.cs (simplified)
if (app.Environment.IsDevelopment())
{
app.UseStaticFiles();
}
else
{
app.MapStaticAssets();
}
app.MapStaticAssets();
app.MapRazorComponents<App>()
.AddInteractiveServerRenderMode();
Repro steps
- Create a Blazor United project on .NET 10.
- Add a component with isolated CSS, for example:
- Home.razor
- Home.razor.css
- Run the app in Development.
- Open the page that uses Home.razor.
- Inspect the page in devtools.
- The scoped CSS bundle appears present in the project output.
- The CSS file seems to load.
- The component renders without the expected isolated styles.
- Move the same CSS rules from Home.razor.css into:
- Inline style on the element, or
- A global stylesheet (site.css).
- Reload the page.
- Styles now apply as expected.
Expected Behavior
Expected behavior
- Isolated CSS (Component.razor.css) should apply to the matching component when the page loads, both in Development and Production.
- If the CSS file loads and the rules are valid, the component should render with the isolated styles, without requiring inline or global CSS as a workaround.
Steps To Reproduce
- Create a Blazor United project on .NET 10.
- Add a component with isolated CSS, for example:
- Home.razor
- Home.razor.css
- Run the app in Development.
- Open the page that uses Home.razor.
- Inspect the page in devtools.
- The scoped CSS bundle appears present in the project output.
- The CSS file seems to load.
- The component renders without the expected isolated styles.
- Move the same CSS rules from Home.razor.css into:
- Inline style on the element, or
- A global stylesheet (site.css).
- Reload the page.
- Styles now apply as expected.
Exceptions (if any)
None found
.NET Version
10
Anything else?
the isolated CSS files were working, and something happened that caused them to stop working. I have worked at this for at least 8 hours - rebooting, remove obj/bin directors, browser hard refresh and cache, deployed to Azure, all resulted in no CSS being applied.
- Scoped CSS output exists under obj/Debug/net10.0/scopedcss.
- The issue looks like a regression in how isolated CSS is wired into the pipeline or referenced from the rendered page.
- I am open to running additional diagnostics, for example exact HTML link tags or network details, if guidance is provided.

Metadata
Metadata
Assignees
Labels
Needs: Author FeedbackThe author of this issue needs to respond in order for us to continue investigating this issue.The author of this issue needs to respond in order for us to continue investigating this issue.area-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor Components