Unhandled exception rendering component: Could not load file or assembly
rafalxyz opened this issue · comments
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
Hi,
When I'm using dotnet watch
during development, I'm running into the error below with every change I make.
blazor.webassembly.js:1 crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: Could not load file or assembly 'onseStream_>5__20, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies.
System.IO.FileNotFoundException: Could not load file or assembly 'onseStream_>5__20, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies.
File name: 'onseStream_>5__20, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'
at SomeProject.SomePage.SomePage.BuildRenderTree(RenderTreeBuilder FormDialog>d__10)
at Microsoft.AspNetCore.Components.ComponentBase.<.ctor>b__6_0(RenderTreeBuilder builder)
at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment, Exception& renderFragmentException)
You may notice the word FormDialog appearing in the logs. It's quite random, though, so I wouldn't look for the root cause there. FormDialog is my custom component, but it's not even used on the page the change is being made. Sometimes, instead of FormDialog, I see names of other components that have nothing do with the changes I make.
What's interesting is that the file or assembly name seems to be "trimmed". I guess instead of "onseStream" there should be something like "ResponseStream".
The error doesn't show up in the terminal, but rather in the browser console. In the terminal, I can only see logs like Hot reload of changes succeeded.
When I refresh the page, I'm running into the error below. I guess it's caused by the error above.
crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: VTable setup of type SomeProject.SomePage failed
System.TypeLoadException: VTable setup of type SomeProject.SomePage failed
at System.RuntimeType.GetPropertiesByName(String name, BindingFlags bindingAttr, MemberListType listType, RuntimeType reflectedType)
at System.RuntimeType.GetPropertyCandidates(String name, BindingFlags bindingAttr, Type[] types, Boolean allowPrefixLookup)
at System.RuntimeType.GetProperties(BindingFlags bindingAttr)
at Microsoft.AspNetCore.Components.Reflection.MemberAssignment.GetPropertiesIncludingInherited(Type type, BindingFlags bindingFlags)+MoveNext()
at Microsoft.AspNetCore.Components.ComponentFactory.CreatePropertyInjector(Type type)
at Microsoft.AspNetCore.Components.ComponentFactory.GetComponentTypeInfo(Type componentType)
at Microsoft.AspNetCore.Components.ComponentFactory.InstantiateComponent(IServiceProvider serviceProvider, Type componentType, IComponentRenderMode callerSpecifiedRenderMode, Nullable1 parentComponentId) at Microsoft.AspNetCore.Components.RenderTree.Renderer.InstantiateChildComponentOnFrame(RenderTreeFrame[] frames, Int32 frameIndex, Int32 parentComponentId) at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.InitializeNewComponentFrame(DiffContext& diffContext, Int32 frameIndex) at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.InitializeNewSubtree(DiffContext& diffContext, Int32 frameIndex) at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.InsertNewFrame(DiffContext& diffContext, Int32 newFrameIndex) at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.AppendDiffEntriesForFramesWithSameSequence(DiffContext& diffContext, Int32 oldFrameIndex, Int32 newFrameIndex) at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.AppendDiffEntriesForRange(DiffContext& diffContext, Int32 oldStartIndex, Int32 oldEndIndexExcl, Int32 newStartIndex, Int32 newEndIndexExcl) at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.AppendDiffEntriesForFramesWithSameSequence(DiffContext& diffContext, Int32 oldFrameIndex, Int32 newFrameIndex) at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.AppendDiffEntriesForRange(DiffContext& diffContext, Int32 oldStartIndex, Int32 oldEndIndexExcl, Int32 newStartIndex, Int32 newEndIndexExcl) at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.AppendDiffEntriesForFramesWithSameSequence(DiffContext& diffContext, Int32 oldFrameIndex, Int32 newFrameIndex) at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.AppendDiffEntriesForRange(DiffContext& diffContext, Int32 oldStartIndex, Int32 oldEndIndexExcl, Int32 newStartIndex, Int32 newEndIndexExcl) at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.AppendDiffEntriesForFramesWithSameSequence(DiffContext& diffContext, Int32 oldFrameIndex, Int32 newFrameIndex) at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.AppendDiffEntriesForRange(DiffContext& diffContext, Int32 oldStartIndex, Int32 oldEndIndexExcl, Int32 newStartIndex, Int32 newEndIndexExcl) at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.ComputeDiff(Renderer renderer, RenderBatchBuilder batchBuilder, Int32 componentId, ArrayRange
1 oldTree, ArrayRange`1 newTree)
Because of this, I'm basically forced to rebuild the whole project with every change I make. Have you ever encountered an error like this? For what it's worth, I'm using MudBlazor in my project.
Expected Behavior
Dotnet watch doesn't fail
Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version
8.0.4
Anything else?
No response
I have a similar issue, I can't change anything, even a small css change requires restarting the application
@tmat trying to get a repro for this first before we transfer this to you, as this seems to be hot reload related.
Unfortunately I can't share it via a public repository, there is too much code, we use a lot of generic types and if I simplify I won't be able to reproduce the error, can I share it via a private repository?
I added a video of what it looks like. Because of this I can't make any changes, I have to restart dotnet watch --non-interactive
which is time consuming.