Fixed DeferredContent parents order #15670
Merged
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.
What does the pull request do?
This PR fixes a bug where parent nodes for deferred content were reversed after #15070.
Unit tests have been added.
What is the current behavior?
Parent nodes were reversed for deferred content, effectively looking up the resources in the wrong order for
StaticResource
.(Note that the bug doesn't manifest everywhere, as it depends on the exact hierarchy of deferred contents, which can be subtle.)
How was the solution implemented (if it's not obvious)?
IAvaloniaXamlIlEagerParentStackProvider
had both implementations whereDirectParents
were in normal order (DeferredParentServiceProvider
), and implementations where they were in stack order, reversed (XamlIlContext
, generated by the XAML compiler).With this PR, the parents are always in stack order, as this was expected by
EagerParentStackEnumerator
.Breaking changes
I renamed
IAvaloniaXamlIlEagerParentStackProvider.DirectParents
toDirectParentsStack
to make the expected order clearer (alongside documentation comments). Since this interface isn't supposed to be implemented by users and is new in 11.1-beta2, it isn't really part of the official public API yet. If that isn't acceptable, please let me know and I'll rename it back.Fixed issues