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

XamlTypeInfo.g.c Trim and Obsolete Warning #10356

Open
ghost1372 opened this issue Feb 14, 2025 · 0 comments
Open

XamlTypeInfo.g.c Trim and Obsolete Warning #10356

ghost1372 opened this issue Feb 14, 2025 · 0 comments
Labels
bug Something isn't working needs-triage Issue needs to be triaged by the area owners

Comments

@ghost1372
Copy link
Contributor

Describe the bug

After enabling AOT compilation (<PublishAot>true</PublishAot>) in my WinUI 3 project, I encountered several warnings related to XamlTypeInfo.

'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicConstructors', 'DynamicallyAccessedMemberTypes.NonPublicConstructors' in call to 'System.Type.TypeInitializer.get'. The parameter 'instance' of method 'PSXMaster.PSXMaster_XamlTypeInfo.XamlTypeInfoProvider.get_127_Type_TypeInitializer(Object)' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.

'Type.IsSerializable' is obsolete: 'Formatter-based serialization is obsolete and should not be used.'

'TypeAttributes.Serializable' is obsolete: 'Formatter-based serialization is obsolete and should not be used.'

Image

when i double click on warning i navigated to this:

Image

Image

Image

Steps to reproduce the bug

Create a WinUI 3 (Windows App SDK) project.
Enable AOT compilation by adding the following to the .csproj file:
<PublishAot>true</PublishAot>
Build the project.

Expected behavior

The XAML compiler should generate code that is compatible with AOT without triggering trimming-related warnings.
Obsolete serialization APIs should not be used in auto-generated code.

Screenshots

No response

NuGet package version

WinUI 3 - Windows App SDK 1.6.5: 1.6.250205002

Windows version

Windows 11 (24H2): Build 26100

Additional context

No response

@ghost1372 ghost1372 added the bug Something isn't working label Feb 14, 2025
@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label Feb 14, 2025
@ghost1372 ghost1372 changed the title AOT Compilation Warnings in WinUI 3 App XamlTypeInfo.g.c Trim and Obsolete Warning Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-triage Issue needs to be triaged by the area owners
Projects
None yet
Development

No branches or pull requests

1 participant