C
C#5w ago
CyberBotX

Blazor site seems to not load properly when the Firefox extension Dark Reader is disabled

So I'm going a bit out of my mind on this one, since I can't expalin how or why it happens. Basically, I am trying to make a small Blazor site, and I use the Firefox extension Dark Reader normally. On a new site, Dark Reader will be active on the site, but if I tell Dark Reader to stop being used on the site and then reload, the page loads but then I get an unhandled error message on the bottom, no functionality of the site works and in some cases the style sheets aren't used. When I check the browser console after enabling detailed errors, I see the following two errors:
Error: There was an error applying batch 3.
Error: System.AggregateException: One or more errors occurred. (TypeError: n.parentNode is null)
---> System.InvalidOperationException: TypeError: n.parentNode is null
at Microsoft.AspNetCore.Components.RenderTree.Renderer.InvokeRenderCompletedCallsAfterUpdateDisplayTask(Task updateDisplayTask, Int32[] updatedComponents)
--- End of inner exception stack trace ---
Error: There was an error applying batch 3.
Error: System.AggregateException: One or more errors occurred. (TypeError: n.parentNode is null)
---> System.InvalidOperationException: TypeError: n.parentNode is null
at Microsoft.AspNetCore.Components.RenderTree.Renderer.InvokeRenderCompletedCallsAfterUpdateDisplayTask(Task updateDisplayTask, Int32[] updatedComponents)
--- End of inner exception stack trace ---
It baffles me why telling Dark Reader not to be used on the site would break it like this. If I re-enable Dark Reader and reload the page, the error doesn't come up. I've attached a small video I took showing how the error comes up, but again, I have no idea how or why it is happening.
1 Reply
CyberBotX
CyberBotXOP5w ago
Oh, also to note, this is happening with both .NET 8 and .NET 9 on a completely new and completely unedited Blazor Web App program. I think another thing I should note is that it doesn't matter if I do this locally or on a published site, the result ends up being the same. Upon even further research, it seems that maybe my Firefox profile might be having something funky going on with it, as removing Dark Reader entirely doesn't fix it, and using another dark mode extension, Midnight Lizard, has the exact same issue, where enabling it for the site makes the site work and disabling it makes it fail. I'm still baffled how such a thing can affect a Blazor app in this way, though.

Did you find this page helpful?