Document and test the runtime XAML namespace fallback - #357
Merged
Merged
Conversation
wieslawsoltes
marked this pull request as ready for review
July 14, 2026 22:18
This was referenced Aug 21, 2026
This was referenced Aug 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
XmlnsDefinitionmappingsInvestigation result
The behavior packages already contain the expected assembly-level
XmlnsDefinitionattributes. Normal compiled XAML resolvesInteraction,EventTriggerBehavior, and the other mapped types correctly.The reported error is reproducible in Avalonia's runtime XAML compiler (the same path used by the previewer), including the
Unable to resolve type InteractionandResolveContentPropertyTransformerdiagnostic cascade. The runtime compiler builds its XML namespace map from assemblies loaded when its static compiler context is initialized. If the behavior assemblies have not yet been loaded, their otherwise-correct attributes are absent from that cached map.Application-defined
XmlnsDefinitionattributes are not themselves invalid; they expose the runtime-loader ordering because the application assembly is available while external behavior assemblies may not be.Why this PR uses a compatibility fallback
This initialization and assembly-discovery behavior lives in Avalonia's runtime XAML loader, outside the behavior package. Changing or duplicating package attributes cannot update a namespace map that the host created before loading those assemblies.
The reliable package-side guidance is to use assembly-qualified CLR namespaces in views affected by the previewer/runtime-loader path. Explicit assembly names make the compiler resolve the required behavior assemblies directly.
Changes
Avalonia.Xaml.InteractivityinXaml.Behaviors.InteractivityAvalonia.Xaml.Interactions.CoreinXaml.Behaviors.InteractionsValidation
dotnet test tests/Xaml.Behaviors.Interactions.UnitTests/Xaml.Behaviors.Interactions.UnitTests.csproj --filter 'FullyQualifiedName~XmlnsDefinitionRuntimeXamlTests' --no-restoredotnet test tests/Xaml.Behaviors.Interactions.UnitTests/Xaml.Behaviors.Interactions.UnitTests.csproj --no-restoregit diff --checkCloses #325