Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cast descendant of GetVisualTreeDescendants() to IElement in DisposeModelAndChildrenHandlers method for better type safety #90

Merged
merged 1 commit into from
Nov 30, 2023

Conversation

mlxyz
Copy link
Contributor

@mlxyz mlxyz commented Oct 26, 2023

I was getting "Specified cast is not valid" exceptions in the DisposeModelAndChildrenHandlers method due to the children of GetVisualTreeDescendants() not always being Element.

This introduces a check that all descendants are IElement (which also removes a dependency on CoreGraphics).
In my manual tests, this fixes the exceptions but I am not 100% sure it's safe to always skip non-IElement children.

…odelAndChildrenHandlers method for better type safety
@LuckyDucko LuckyDucko self-assigned this Nov 6, 2023
@LuckyDucko LuckyDucko merged commit c51d66f into LuckyDucko:master Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants