Open busitech opened 8 months ago
Can you test with nightly builds? It shouldn't be reproducible there.
The above test was run from a fresh checkout of the master branch, from within the Avalonia solution, by modifying the Generators.Sandbox project. The commit I used was fea57b920a3c835b4bada7dc409af619517e93e7
Let me know if there is a better branch to use for my test, or if that is equivalent with the nightly build.
In case there was any doubt, using a pre-built nightly package produces the same error as when I built from source.
I have added two PRs for debugging and fixing:
Describe the bug
The
AvaloniaNameGenerator
uses theTypeReferenceResolver
when parsing markup files.During parsing, when an element is found having an
x:TypeArguments
attribute and a property element, when the property element is visited theTypeReferenceResolver
throwsXamlTransformException: Unable to resolve type from namespace.
At the time of the exception, the declaring type for the property is what the
TypeReferenceResolver
is trying to resolve.A property element is not allowed to have an
x:TypeArguments
attribute, so theTypeReferenceResolver
naively tries to resolve the declaring class of the property with no type arguments, even when the declaring type on the property element and the type on the node above which has thex:TypeArguments
are exactly the same name. This leads to the type not being found and the exception thrown.To Reproduce
This markup easily reproduces the issue:
Expected behavior
The exception should not be thrown, because the x:TypeArguments from the parent node (the declaring type having the property) should be used when resolving the declaring type.
Environment
Additional context