Force ShapeHandler to exist when adding shape to border #18076
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of Change
TL;DR: If a border has an attached Shape and the shape handler is null, fire a
ToHandler
orToPlatform
to force it to exist. This will then let the underlying APIs that assume the handler to exist to work.When Shapes are added as part of another item (Ex. Border), the handlers are never fired. The shapes themselves do exist and in .NET 8, with our recent changes to LogicalChildren, they now (correctly) appear as underlying elements. But because the handlers are null, any tooling that touches them will explode. Handlers should, as far as I can tell, always exist on a given element after they are created. These shapes are created, but the handlers are never attached.
This PR attempts to force that to happen. Whenever the border gets created, if a shape is attached as is null, it will force it to exist. This should fix Visual Diagnostic tooling and others who depend on it.
Issues Fixed
Fixes #18070
Fixes #16919
Fixes #