Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows Build Errors #25132

Closed
Redth opened this issue Oct 8, 2024 · 19 comments
Closed

Windows Build Errors #25132

Redth opened this issue Oct 8, 2024 · 19 comments

Comments

@Redth
Copy link
Member

Redth commented Oct 8, 2024

There have been some recent changes to .NET SDK for Windows introduce support for different projection profiles to be used as well as new roslyn analyzers introduced to help detect incompatibilities with your code and Native AOT. These changes can cause some issues with existing .NET MAUI projects but are generally easy to work around.

Given the complexity of how some of these pieces fit together there are a number of areas which will ship servicing fixes to address the issues:

  • MAUI .NET 9 RTM workload with an updated WindowsAppSDK reference to 1.6.x (MAUI currently references 1.5.x)
  • .NET 9 RTM SDK with fixes for overly eager analyzer execution, improved fallback profile package logic
  • WindowsAppSDK 1.6 servicing update

There are some related issues for those interested to learn more:

More on AOT / Trimming support in Windows / CsWinRT:

Warnings / Errors and Workarounds

There are a few examples of warnings/errors you may encounter below:

MVVMTKCFG0003 - This version of the MVVM Toolkit requires 'Microsoft.Windows.SDK.NET.Ref' version '10.0.19041.38' or later. Please update to .NET SDK 8.0.109, 8.0.305 or 8.0.402 (or later). Alternatively, use a temporary 'Microsoft.Windows.SDK.NET.Ref' reference, which can be done by setting the 'WindowsSdkPackageVersion' property in your .csproj file. For your project configuration, it is recommended to set the package version to '10.0.19041.41'.

Could not load file or assembly 'WinRT.Runtime, Version=2.1.0.0, Culture=neutral, PublicKeyToken=99ea127f02d97709'. The system cannot find the file specified.":"WinRT.Runtime, Version=2.1.0.0, Culture=neutral, PublicKeyToken=99ea127f02d97709

CS0433: The type 'TextDecorations' exists in both 'Microsoft.WinUI, Version=3.0.0.0, Culture=neutral, PublicKeyToken=de31ebe4ad15742b' and 'Microsoft.Windows.SDK.NET, Version=10.0.20348.38, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

To fix these errors, you can add a property to your .csproj file:

<PropertyGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'"">
    <WindowsSdkPackageVersion>10.0.19041.38</WindowsSdkPackageVersion>
</PropertyGroup>

If you see an error similar to the one below, you will need to add a partial identifier to the class mentioned in the error due to a new analyzer detecting code which is not Native AOT compatible:

CsWinRT1028: Class 'MauiCommandBar' implements WinRT interfaces but isn't marked partial. Type should be marked partial for trimming and AOT compatibility if passed across the WinRT ABI.

WebView2 - Type exists in both WebView2.Core and Microsoft.WinUI

If you encounter an error similar to this:

net8.0-windows10.0.19041.0\win10-x64\intermediatexaml\WinRT.SourceGenerator\Generator.RcwReflectionFallbackGenerator\RcwFallbackInitializer.g.cs(1296,125,1296,137): error CS0433: The type 'CoreWebView2' exists in both 'Microsoft.Web.WebView2.Core, Version=1.0.864.35, Culture=neutral, PublicKeyToken=2a8ab48044d2601e' and 'Microsoft.WinUI, Version=3.0.0.0, Culture=neutral, PublicKeyToken=de31ebe4ad15742b'

You can set this property in your project for now:

<PropertyGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'"">
  <CsWinRTRcwFactoryFallbackGeneratorForceOptOut>true</CsWinRTRcwFactoryFallbackGeneratorForceOptOut>
</PropertyGroup>

There is already an associated PR with the fix: microsoft/CsWinRT#1816 which will be released in an upcoming servicing release.

@dotnet-policy-service dotnet-policy-service bot added the s/triaged Issue has been reviewed label Oct 8, 2024
@Redth Redth pinned this issue Oct 8, 2024
@Redth Redth added this to the .NET 9.0 GA milestone Oct 8, 2024
@Redth Redth moved this from Todo to In Progress in MAUI SDK Ongoing Oct 8, 2024
@jayhayman-hdd
Copy link

Is this also related to the latest VS update to 17.11.5? Since applying this update this evening, MAUI Windows no longer builds with many (33) errors all along the lines of:

The type 'CoreWebView2' exists in both 'Microsoft.Web.WebView2.Core, Version=1.0.864.35, Culture=neutral, PublicKeyToken=2a8ab48044d2601e' and 'Microsoft.WinUI, Version=3.0.0.0, Culture=neutral, PublicKeyToken=de31ebe4ad15742b'	Cylch.Atp.Maui.App (net8.0-windows10.0.19041.0)	D:\hayman-dev\Cylch\Reseller\ATP\MAUI\Cylch.Atp.Maui.App\obj\Debug\net8.0-windows10.0.19041.0\win10-x64\intermediatexaml\WinRT.SourceGenerator\Generator.RcwReflectionFallbackGenerator\RcwFallbackInitializer.g.cs
The type 'CoreWebView2AcceleratorKeyPressedEventArgs' exists in both 'Microsoft.Web.WebView2.Core, Version=1.0.864.35, Culture=neutral, PublicKeyToken=2a8ab48044d2601e' and 'Microsoft.WinUI, Version=3.0.0.0, Culture=neutral, PublicKeyToken=de31ebe4ad15742b'	Cylch.Atp.Maui.App (net8.0-windows10.0.19041.0)	D:\hayman-dev\Cylch\Reseller\ATP\MAUI\Cylch.Atp.Maui.App\obj\Debug\net8.0-windows10.0.19041.0\win10-x64\intermediatexaml\WinRT.SourceGenerator\Generator.RcwReflectionFallbackGenerator\RcwFallbackInitializer.g.cs

I've added the following PropertyGroup as mentioned above but this only added an additional 7 compile errrors.

<PropertyGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'"">
    <WindowsSdkPackageVersion>10.0.19041.38</WindowsSdkPackageVersion>
</PropertyGroup>

@Redth
Copy link
Member Author

Redth commented Oct 8, 2024

@jayhayman-hdd can you open a new issue with more details and a repro? Thanks!

@manodasanW
Copy link

Is this also related to the latest VS update to 17.11.5? Since applying this update this evening, MAUI Windows no longer builds with many (33) errors all along the lines of:

The type 'CoreWebView2' exists in both 'Microsoft.Web.WebView2.Core, Version=1.0.864.35, Culture=neutral, PublicKeyToken=2a8ab48044d2601e' and 'Microsoft.WinUI, Version=3.0.0.0, Culture=neutral, PublicKeyToken=de31ebe4ad15742b'	Cylch.Atp.Maui.App (net8.0-windows10.0.19041.0)	D:\hayman-dev\Cylch\Reseller\ATP\MAUI\Cylch.Atp.Maui.App\obj\Debug\net8.0-windows10.0.19041.0\win10-x64\intermediatexaml\WinRT.SourceGenerator\Generator.RcwReflectionFallbackGenerator\RcwFallbackInitializer.g.cs
The type 'CoreWebView2AcceleratorKeyPressedEventArgs' exists in both 'Microsoft.Web.WebView2.Core, Version=1.0.864.35, Culture=neutral, PublicKeyToken=2a8ab48044d2601e' and 'Microsoft.WinUI, Version=3.0.0.0, Culture=neutral, PublicKeyToken=de31ebe4ad15742b'	Cylch.Atp.Maui.App (net8.0-windows10.0.19041.0)	D:\hayman-dev\Cylch\Reseller\ATP\MAUI\Cylch.Atp.Maui.App\obj\Debug\net8.0-windows10.0.19041.0\win10-x64\intermediatexaml\WinRT.SourceGenerator\Generator.RcwReflectionFallbackGenerator\RcwFallbackInitializer.g.cs

I've added the following PropertyGroup as mentioned above but this only added an additional 7 compile errrors.

<PropertyGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'"">
    <WindowsSdkPackageVersion>10.0.19041.38</WindowsSdkPackageVersion>
</PropertyGroup>

@jayhayman-hdd in the issue you open, can you also comment on what version of Microsoft.Web.WebView2 package you have referenced if any and what version of Microsoft.WinAppSDK package do you have referenced? WinAppSDK has in past versions included the WebView types but in their recent 1.6 version, they forwarded the types from its package to the new WebView package. But it seems you had access to the older WebView types for netcore3 from before that change and also the WinAppSDK version of them at the same time which I don't believe worked together until the 1.6 version.

That pre-existing issue is getting exposed by the code generated by RcwFallbackInitializer which is meant to make sure older projections don't get trimmed unexpectedly. You can disable the RcwFallbackInitializer by setting the property CsWinRTRcwFactoryFallbackGeneratorForceOptOut to true to get unblocked if you do not make use of the WebView2 types.

@espenrl
Copy link
Contributor

espenrl commented Oct 9, 2024

CsWinRTRcwFactoryFallbackGeneratorForceOptOut leads to lots of

Generator.WinRTAotSourceGenerator\WinRTGenericInstantiation.g.cs(2531,31,2531,47): error CS0227: Unsafe code may only appear if compiling with /unsafe

CsWinRTRcwFactoryFallbackGeneratorForceOptOut works, but don't combine it with <WindowsSdkPackageVersion>10.0.19041.38</WindowsSdkPackageVersion> :)

@jayhayman-hdd
Copy link

I haven't had a chance to test this today as the team has been wrapping up a prod release for a client tomorrow. If anyone has already opened this as a new issue, I'll happily add my experience to it tomorrow (Thursday), or I'll create a new issue. Just glad I set a policy for me to canary new releases before being applied to the team ;)

The project that failed to build (https://apps.microsoft.com/detail/9n5w2tkq5sf0?hl=en-gb&gl=GB / https://play.google.com/store/apps/details?id=com.assettrackerpro.capture&hl=en-GB) has been an early MAUI project from .Net 6 onwards (but I think I re-created the project from a blank MAUI .Net 7 template) that has been upgraded with each minor and major release so possibly it's picked up some cruft. Deploys to Windows 10, Windows 11, iOS and Android. This project is bit of a big one...

I have another MAUI project that's a bit smaller (https://www.ben-app.co.uk/) that was created a few months ago so I'll try that on my spare dev box at home tonight.

@bdovaz
Copy link

bdovaz commented Oct 9, 2024

I have updated:

Image

And it does not compile the AddWindows method, it is as if it did not exist:

https://github.com/dotnet/maui/blob/9.0.0-rc.2.24503.2/src/Core/src/LifecycleEvents/Windows/WindowsLifecycleExtensions.cs#L7

@jayhayman-hdd
Copy link

Raised a new issue here: #25160

@Redth
Copy link
Member Author

Redth commented Oct 9, 2024

@bdovaz have you actually installed .NET 9 RC2 release of the SDK and installed the corresponding new workloads?

While often the newer 'nuget' than the workload you have installed can be used in projects, it isn't always guaranteed to work that way. In this case I believe you will need the .NET 9 RC2 SDK plus dotnet workload install maui --version 9.0.100-rc.2.24503.1 to get the latest workloads for it.

@bdovaz
Copy link

bdovaz commented Oct 10, 2024

@Redth ok, it's just that until now I was only consuming the preview package using the .NET 8 SDK but I see that I'm out of luck and I have to change the SDK. I will wait for the GA release then.

Thanks.

@thanh-tran-tien
Copy link

thanh-tran-tien commented Oct 10, 2024

follow this and it throw new error: "Exception has been thrown by the target of an invocation" . i use Telerik trial

There have been some recent changes to .NET SDK for Windows introduce support for different projection profiles to be used as well as new roslyn analyzers introduced to help detect incompatibilities with your code and Native AOT. These changes can cause some issues with existing .NET MAUI projects but are generally easy to work around.

Given the complexity of how some of these pieces fit together there are a number of areas which will ship servicing fixes to address the issues:

  • MAUI .NET 9 RTM workload with an updated WindowsAppSDK reference to 1.6.x (MAUI currently references 1.5.x)
  • .NET 9 RTM SDK with fixes for overly eager analyzer execution, improved fallback profile package logic
  • WindowsAppSDK 1.6 servicing update

There are some related issues for those interested to learn more:

More on AOT / Trimming support in Windows / CsWinRT:

Warnings / Errors and Workarounds

There are a few examples of warnings/errors you may encounter below:

MVVMTKCFG0003 - This version of the MVVM Toolkit requires 'Microsoft.Windows.SDK.NET.Ref' version '10.0.19041.38' or later. Please update to .NET SDK 8.0.109, 8.0.305 or 8.0.402 (or later). Alternatively, use a temporary 'Microsoft.Windows.SDK.NET.Ref' reference, which can be done by setting the 'WindowsSdkPackageVersion' property in your .csproj file. For your project configuration, it is recommended to set the package version to '10.0.19041.41'.

Could not load file or assembly 'WinRT.Runtime, Version=2.1.0.0, Culture=neutral, PublicKeyToken=99ea127f02d97709'. The system cannot find the file specified.":"WinRT.Runtime, Version=2.1.0.0, Culture=neutral, PublicKeyToken=99ea127f02d97709

CS0433: The type 'TextDecorations' exists in both 'Microsoft.WinUI, Version=3.0.0.0, Culture=neutral, PublicKeyToken=de31ebe4ad15742b' and 'Microsoft.Windows.SDK.NET, Version=10.0.20348.38, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

To fix these errors, you can add a property to your .csproj file:

<PropertyGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'"">
10.0.19041.38

If you see an error similar to the one below, you will need to add a partial identifier to the class mentioned in the error due to a new analyzer detecting code which is not Native AOT compatible:

CsWinRT1028: Class 'MauiCommandBar' implements WinRT interfaces but isn't marked partial. Type should be marked partial for trimming and AOT compatibility if passed across the WinRT ABI.

WebView2 - Type exists in both WebView2.Core and Microsoft.WinUI

If you encounter an error similar to this:

net8.0-windows10.0.19041.0\win10-x64\intermediatexaml\WinRT.SourceGenerator\Generator.RcwReflectionFallbackGenerator\RcwFallbackInitializer.g.cs(1296,125,1296,137): error CS0433: The type 'CoreWebView2' exists in both 'Microsoft.Web.WebView2.Core, Version=1.0.864.35, Culture=neutral, PublicKeyToken=2a8ab48044d2601e' and 'Microsoft.WinUI, Version=3.0.0.0, Culture=neutral, PublicKeyToken=de31ebe4ad15742b'

You can set this property in your project for now:

<PropertyGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'"">
true

There is already an associated PR with the fix: microsoft/CsWinRT#1816 which will be released in an upcoming servicing release.

@aloh86
Copy link

aloh86 commented Oct 11, 2024

I have a packaged WinUI 3 project that broke. Adding

<PropertyGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">
    <WindowsSdkPackageVersion>10.0.19041.38</WindowsSdkPackageVersion>
</PropertyGroup>

got rid of the Unsafe code may only appear if compiling with /unsafe message, but now I'm getting the error:

Severity	Code	Description	Project	File	Line	Suppression State
Error (active)	MSB4044	The "ResolvePackageAssets" task was not given a value for the required parameter "TargetFramework".	C:\Program Files\dotnet\sdk\8.0.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets	266	

My .csproj file has defined TargetFramework as:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">
    <OutputType>WinExe</OutputType>
    <TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
...

@thanh-tran-tien
Copy link

thanh-tran-tien commented Oct 11, 2024

May be which depend on SkiaSharp like Telerik will cause this. When VS2022 ver 17.11.5 cant build maui i switch to Rider try to build it but it have the same. Roll back to previous version 17.11.4 saved me

@hunsra
Copy link

hunsra commented Oct 15, 2024

If you encounter an error similar to this:

net8.0-windows10.0.19041.0\win10-x64\intermediatexaml\WinRT.SourceGenerator\Generator.RcwReflectionFallbackGenerator\RcwFallbackInitializer.g.cs(1296,125,1296,137): error CS0433: The type 'CoreWebView2' exists in both 'Microsoft.Web.WebView2.Core, Version=1.0.864.35, Culture=neutral, PublicKeyToken=2a8ab48044d2601e' and 'Microsoft.WinUI, Version=3.0.0.0, Culture=neutral, PublicKeyToken=de31ebe4ad15742b'

You can set this property in your project for now:

<PropertyGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'"">
true

There is already an associated PR with the fix: microsoft/CsWinRT#1816 which will be > released in an upcoming servicing release.

This doesn't resolve the issue. I'm dead in the water again. Also, there's a typo in the suggested workaround. There's an extra " after 'windows'.

@manodasanW
Copy link

@hunsra Can you post the error you are hitting? Is it the same as the WebView error above?

@hunsra
Copy link

hunsra commented Oct 16, 2024

@hunsra Can you post the error you are hitting? Is it the same as the WebView error above?

Sure. It is not the same, as it doesn't refer to WebView2. In fact, it doesn't refer to any specific assembly. It's similar in that it relates to the WinRT.SourceGenerator on Windows:

D:\Repos\Concord\Concord\obj\Debug\net8.0-windows10.0.26100.0\win10-x64\intermediatexaml\WinRT.SourceGenerator\Generator.WinRTAotSourceGenerator\WinRTGenericInstantiation.g.cs(14,32,14,36): error CS0227: Unsafe code may only appear if compiling with /unsafe

The error message repeats 96 times with different values in the parentheses following ".g.cs". I tried the suggestion from @Redth above to add the following to the project file:

<PropertyGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">
	<CsWinRTRcwFactoryFallbackGeneratorForceOptOut>true</CsWinRTRcwFactoryFallbackGeneratorForceOptOut>
</PropertyGroup>

However, that didn't resolve the issue. I had to remove the following from the project file as well, as suggested by @espenrl above:

<WindowsSdkPackageVersion>10.0.26100.41</WindowsSdkPackageVersion>

This was previously added by suggestion in the past to resolve a different build issue I had with a prior .NET MAUI release. However, now it will build with it removed. This .NET MAUI release seems to have also introduced other issues such as a new crash in XAML parsing on iOS that wasn't present before, but that's a different page in the saga.

@Arslan007
Copy link

Arslan007 commented Oct 17, 2024

This worked for me

<PropertyGroup>
        <TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.22621.0</TargetFrameworks>
        <OutputType Condition="'$(TargetFramework)' != 'net8.0'">Exe</OutputType>

        <!-- Versions -->
        <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
        <TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
	<WindowsSdkPackageVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.22621.38</WindowsSdkPackageVersion>
	<CsWinRTRcwFactoryFallbackGeneratorForceOptOut Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">true</CsWinRTRcwFactoryFallbackGeneratorForceOptOut>
        <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
        <DefaultLanguage>en</DefaultLanguage>
    </PropertyGroup>

@Redth Redth modified the milestones: .NET 9.0 GA, .NET 9 SR1 Oct 29, 2024
@rodrigovaras
Copy link

rodrigovaras commented Oct 31, 2024

I follow most of the instructions here but it still getting an error message after I attempt to build my MAUI application:

Please notice that the generated type is not part of my source code but auto generated

1>D:\teksoft\PointPerfect.net\artifacts\obj\PointPerfect.IoT.UI\debug_net8.0-windows10.0.22621.0\XamlTypeInfo.g.cs(71,25,71,45): error CsWinRT1028: Class 'XamlMetaDataProvider' implements WinRT interfaces but isn't marked partial. Type should be marked partial for trimming and AOT compatibility if passed across the ABI. (https://github.com/microsoft/CsWinRT/tree/master/src/Authoring/WinRT.SourceGenerator/AnalyzerReleases.Shipped.md)
1>D:\teksoft\PointPerfect.net\src\UI\PointPerfect.IoT.UI\Platforms\Windows\App.xaml.cs(11,22,11,25): error CsWinRT1029: Class 'App' implements WinRT interface(s) IApplicationOverrides, IXamlMetadataProvider generated using an older version of CsWinRT. Update to a projection generated using CsWinRT 2.1.0 or later for trimming and AOT compatibility. (https://github.com/microsoft/CsWinRT/tree/master/src/Authoring/WinRT.SourceGenerator/AnalyzerReleases.Shipped.md)
1>D:\teksoft\PointPerfect.net\artifacts\obj\PointPerfect.IoT.UI\debug_net8.0-windows10.0.22621.0\XamlTypeInfo.g.cs(71,25,71,45): error CsWinRT1029: Class 'XamlMetaDataProvider' implements WinRT interface(s) IXamlMetadataProvider generated using an older version of CsWinRT. Update to a projection generated using CsWinRT 2.1.0 or later for trimming and AOT compatibility. (https://github.com/microsoft/CsWinRT/tree/master/src/Authoring/WinRT.SourceGenerator/AnalyzerReleases.Shipped.md)
1>D:\teksoft\PointPerfect.net\artifacts\obj\PointPerfect.IoT.UI\debug_net8.0-windows10.0.22621.0\XamlTypeInfo.g.cs(1718,20,1718,30): error CsWinRT1028: Class 'XamlMember' implements WinRT interfaces but isn't marked partial. Type should be marked partial for trimming and AOT compatibility if passed across the ABI. (https://github.com/microsoft/CsWinRT/tree/master/src/Authoring/WinRT.SourceGenerator/AnalyzerReleases.Shipped.md)
1>D:\teksoft\PointPerfect.net\artifacts\obj\PointPerfect.IoT.UI\debug_net8.0-windows10.0.22621.0\XamlTypeInfo.g.cs(1718,20,1718,30): error CsWinRT1029: Class 'XamlMember' implements WinRT interface(s) IXamlMember generated using an older version of CsWinRT. Update to a projection generated using CsWinRT 2.1.0 or later for trimming and AOT compatibility. (https://github.com/microsoft/CsWinRT/tree/master/src/Authoring/WinRT.SourceGenerator/AnalyzerReleases.Shipped.md)
1>D:\teksoft\PointPerfect.net\artifacts\obj\PointPerfect.IoT.UI\debug_net8.0-windows10.0.22621.0\XamlTypeInfo.g.cs(1437,20,1437,38): error CsWinRT1028: Class 'XamlSystemBaseType' implements WinRT interfaces but isn't marked partial. Type should be marked partial for trimming and AOT compatibility if passed across the ABI. (https://github.com/microsoft/CsWinRT/tree/master/src/Authoring/WinRT.SourceGenerator/AnalyzerReleases.Shipped.md)
1>D:\teksoft\PointPerfect.net\artifacts\obj\PointPerfect.IoT.UI\debug_net8.0-windows10.0.22621.0\XamlTypeInfo.g.cs(1437,20,1437,38): error CsWinRT1029: Class 'XamlSystemBaseType' implements WinRT interface(s) IXamlType generated using an older version of CsWinRT. Update to a projection generated using CsWinRT 2.1.0 or later for trimming and AOT compatibility. (https://github.com/microsoft/CsWinRT/tree/master/src/Authoring/WinRT.SourceGenerator/AnalyzerReleases.Shipped.md)
1>D:\teksoft\PointPerfect.net\artifacts\obj\PointPerfect.IoT.UI\debug_net8.0-windows10.0.22621.0\XamlTypeInfo.g.cs(1487,20,1487,32): error CsWinRT1028: Class 'XamlUserType' implements WinRT interfaces but isn't marked partial. Type should be marked partial for trimming and AOT compatibility if passed across the ABI. (https://github.com/microsoft/CsWinRT/tree/master/src/Authoring/WinRT.SourceGenerator/AnalyzerReleases.Shipped.md)
1>D:\teksoft\PointPerfect.net\artifacts\obj\PointPerfect.IoT.UI\debug_net8.0-windows10.0.22621.0\XamlTypeInfo.g.cs(1487,20,1487,32): error CsWinRT1029: Class 'XamlUserType' implements WinRT interface(s) IXamlType generated using an older version of CsWinRT. Update to a projection generated using CsWinRT 2.1.0 or later for trimming and AOT compatibility. (https://github.com/microsoft/CsWinRT/tree/master/src/Authoring/WinRT.SourceGenerator/AnalyzerReleases.Shipped.md)

@manodasanW
Copy link

@rodrigovaras Is your project marked as AOT compatible (either with PublishAot or IsAotCompatible) or do you have a CsWinRT package reference? I expect those to only show up as warnings in those scenarios otherwise it would just be info diagnostics. WinAppSDK 1.6 has addressed this to make sure the code it generates is generated as partial for these to not be seen for folks in those scenarios.

@PureWeen PureWeen modified the milestones: .NET 9 SR1, .NET 9.0 GA Nov 5, 2024
@PureWeen
Copy link
Member

This should be resolved now with the release of .NET 9 GA

@github-project-automation github-project-automation bot moved this from Todo to Done in MAUI SDK Ongoing Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests