MobileBlazorBindings icon indicating copy to clipboard operation
MobileBlazorBindings copied to clipboard

Change Debug.Fail() to Debug.WriteLine() in the NativeComponentAdapter()

Open lachlanwgordon opened this issue 4 years ago • 0 comments

In the NativeComponent adapter there are two Debug.Fail() calls. When debugging on iOS or Android these are basically the same as Debug.WriteLine and the app keeps running with a log in the console. When running on UWP this causes the app to pause, but if you hit play it seems to keep working fine.

Am I allowed to change these to Debug.WriteLine()s to make UWP usable and have it behave more consistently across platforms?

I've also created an issue(#295) to track the error that is causing this to happen.

The new block would look like:

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...");
                    }

lachlanwgordon avatar Jan 12 '21 10:01 lachlanwgordon