-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Description
I migrated a small net9 app to net10. The tfm is windows.
When starting up, the app crashes:
System.ArgumentException: 'We only support xmlns aggregation in http://schemas.microsoft.com/dotnet/maui/global (Parameter 'target')
I tracked down the issue in that code:
https://github.com/dotnet/maui/blob/10.0.0-preview.6.25359.8/src/Controls/src/Core/XmlnsDefinitionAttribute.cs
I added debug info for the generated code, as there is no XmlnsDefinition attribute in my own code, nor in the obj folder:
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
CompilerGeneratedFilesOutputPath>.\obj\DebugGeneratedFile</CompilerGeneratedFilesOutputPath>
A quick search shows that one of those generated file DOES have the offending XmlnsDefinition which triggers the crash.
Get-ChildItem -Recurse -File | Where-Object {$_.Extension -ne ".dll"} | Select-String "XmlnsDefinition" | ForEach-Object {
>> Write-Host "$($_.Path):$($_.LineNumber)" -ForegroundColor Cyan
>> Write-Host " $($_.Line.Trim())" -ForegroundColor Yellow
Among the results:
.\obj\DebugGeneratedFile\Microsoft.Maui.Controls.SourceGen\Microsoft.Maui.Controls.SourceGen.CodeBehindGenerator\GlobalXmlns.g.cs:12
[assembly: global::Microsoft.Maui.Controls.XmlnsDefinition("http://schemas.microsoft.com/dotnet/maui/global", "http://schemas.microsoft.com/dotnet/2021/maui")]
And looking at that file, it appears that the value for the XmlnsDefinition is incorrect. It can't be "http://schemas.microsoft.com/dotnet/2021/maui" as that triggers the crash.
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a .NET MAUI source generator.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
[assembly: global::Microsoft.Maui.Controls.XmlnsDefinition("http://schemas.microsoft.com/dotnet/maui/global", "http://schemas.microsoft.com/dotnet/2021/maui")]
[assembly: global::Microsoft.Maui.Controls.XmlnsPrefix("http://schemas.microsoft.com/dotnet/maui/global", "global")]
#if MauiAllowImplicitXmlnsDeclaration
[assembly: global::Microsoft.Maui.Controls.Xaml.Internals.AllowImplicitXmlnsDeclaration]
#endif
I verified that the app is using the preview 6 version of that Microsoft.Maui.Controls nuget:

Steps to Reproduce
I tried with an empty app, but that does not trigger the issue. Not sure why.
Link to public reproduction project repository
No response
Version with bug
10.0.0-preview.6
Is this a regression from previous behavior?
Yes, this used to work in .NET MAUI
Last version that worked well
9.0.90 SR9
Affected platforms
Windows
Affected platform versions
net10.0-windows10.0.19041.0
Did you find any workaround?
Rollback to net9.
Relevant log output
see above
Metadata
Metadata
Assignees
Labels
Type
Projects
Status