You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Strict type resolution fails when namespace is not on the top-level element #14161
area/code-generationCategorizes an issue or PR as relevant to code generationdifficulty/medium 🤔Categorizes an issue for which the difficulty level is reachable with a good understanding of WinUIkind/bugSomething isn't working
@jeromelaban Based on the workaround you did, the problem isn't really about embed:MauiHost, it's about controls:EmbeddedControl which is referenced in Source="controls:EmbeddedControl"
thrownewInvalidOperationException("The type {0} could not be found".InvariantCultureFormat(name));
}
returntype;
}
We are calling GetType("controls:EmbeddedControl"), which has absolutely no context about the surrounding XAML and we use _fileDefinition.Namespaces for resolution in this code path.
Looking closer, I think we will need to find a way to store namespaces as we encounter them here:
area/code-generationCategorizes an issue or PR as relevant to code generationdifficulty/medium 🤔Categorizes an issue for which the difficulty level is reachable with a good understanding of WinUIkind/bugSomething isn't working
Activity
fix: Add workaround for unoplatform/uno#14161
Merge pull request #363 from unoplatform/dev/jela/maui-ns-toplevel
fix: Add workaround for unoplatform/uno#14161
Youssef1313 commentedon Oct 30, 2023
In general, the generator is able to figure out the namespace when it's not in top-level element.
The following test is passing:
So it's looking like there is something very specific going on here.
Youssef1313 commentedon Oct 30, 2023
@jeromelaban Based on the workaround you did, the problem isn't really about
embed:MauiHost, it's aboutcontrols:EmbeddedControlwhich is referenced inSource="controls:EmbeddedControl"Youssef1313 commentedon Oct 30, 2023
@jeromelaban
uno/src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlFileGenerator.Reflection.cs
Lines 551 to 561 in 16f9aa9
We are calling
GetType("controls:EmbeddedControl"), which has absolutely no context about the surrounding XAML and we use_fileDefinition.Namespacesfor resolution in this code path.Looking closer, I think we will need to find a way to store namespaces as we encounter them here:
uno/src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlFileParser.cs
Lines 375 to 379 in 16f9aa9