-
-
Notifications
You must be signed in to change notification settings - Fork 116
Closed
Description
Describe the bug
When you search for a component that inherits from another component after you did a search of components of the base class the following exception is thrown:
Message:
System.InvalidCastException : Unable to cast object of type 'Bunit.Rendering.RenderedComponent`1[BUnitRepro.Client.Tests.Components.WorkingComponent]' to type 'Bunit.IRenderedComponentBase`1[BUnitRepro.Client.Tests.Components.SubComponent]'.
Stack Trace:
TestRenderer.GetOrCreateRenderedComponent[TComponent](RenderTreeFrameDictionary framesCollection, Int32 componentId, TComponent component)
TestRenderer.<FindComponents>g__FindComponentsInRenderTree|43_0[TComponent](Int32 componentId, <>c__DisplayClass43_0`1&)
TestRenderer.FindComponents[TComponent](IRenderedFragmentBase parentComponent, Int32 resultLimit)
TestRenderer.FindComponents[TComponent](IRenderedFragmentBase parentComponent)
RenderedFragmentExtensions.FindComponents[TComponent](IRenderedFragment renderedFragment)
TestPageTests.FindBothInReverseInheritanceOrder() line 46
RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
Example:
Example can be found in the following git repo in the BUnitRepro.Client.Tests project
https://github.com/BlueDragon709/BUnitRepro/blob/master/BUnitRepro.Client.Tests/TestPageTests.cs
Expected behavior:
To be able to find a component by type in any order of calling FindComponent<T>
or FindComponents<T>
without crashing.
Version info:
- bUnit version: 1.38.5
- .NET Runtime and Blazor version: 9.0.3
- OS type and version: Windows 10 Professional 22H2 - 19045.5487
Additional context:
None
Metadata
Metadata
Assignees
Labels
No labels