MobileBlazorBindings icon indicating copy to clipboard operation
MobileBlazorBindings copied to clipboard

Child/Parent error in NativeComponentAdaper when using shell

Open lachlanwgordon opened this issue 4 years ago • 0 comments

In the NativeComponentAdapter the if an if check to make sure a child has the correct parent.

if (!Renderer.ElementManager.IsParentOfChild(_closestPhysicalParent, matchedEarlierSibling._targetElement))
                    {
                        Debug.WriteLine($"Expected that the item found ({matchedEarlierSibling.DebugName}) with target element ({matchedEarlierSibling._targetElement.GetType().FullName}) should necessarily be an immediate child of the closest native parent ({_closestPhysicalParent.GetType().FullName}), but it wasn't...");
                    }

I'm not quite sure what the point of the check is but it looks like someone put it there for a reason. The condition hits when using Shell in the ControlGallery.

The error it logs is:

Expected that the item found ([#49] For: 'Microsoft.MobileBlazorBindings.Elements.ShellProperties') with target element (Microsoft.MobileBlazorBindings.Elements.Handlers.ShellPropertiesHandler) should necessarily be an immediate child of the closest native parent (Microsoft.MobileBlazorBindings.Elements.Handlers.ContentPageHandler), but it wasn't...

lachlanwgordon avatar Jan 12 '21 10:01 lachlanwgordon