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

SettingsExpander or SettingsCard crashes the application when NativeAOT enabled #568

Closed
3 of 24 tasks
Baka632 opened this issue Nov 24, 2024 · 3 comments
Closed
3 of 24 tasks
Labels
bug Something isn't working need more info 📌
Milestone

Comments

@Baka632
Copy link

Baka632 commented Nov 24, 2024

Describe the bug

When I enable NativeAOT by the following code in my project file:

<PublishAot>True</PublishAot>

And defined a SettingsExpander (or a SettingsCard) in a really simple way:

<Grid>
    <controls:SettingsExpander Header="Hello!" HeaderIcon="Accept" />
    <!--<controls:SettingsCard Header="Hello!" HeaderIcon="Accept" />-->
</Grid>

It crashes on startup, getting an exception: Microsoft.UI.Xaml.Markup.XamlParseException:“XAML parsing failed.”

Steps to reproduce

1. Enable NativeAOT in project file, using `<PublishAot>True</PublishAot>`.
2. Add a `SettingsExpander` or `SettingsCard` to the layout.  
3. Run the application.  
4. Observe that the application crashes.

Expected behavior

The application should not crash when NativeAOT enabled.

Screenshots

No response

Code Platform

  • UWP
  • WinAppSDK / WinUI 3
  • Web Assembly (WASM)
  • Android
  • iOS
  • MacOS
  • Linux / GTK

Windows Build Number

  • Windows 10 1809 (Build 17763)
  • Windows 10 1903 (Build 18362)
  • Windows 10 1909 (Build 18363)
  • Windows 10 2004 (Build 19041)
  • Windows 10 20H2 (Build 19042)
  • Windows 10 21H1 (Build 19043)
  • Windows 10 21H2 (Build 19044)
  • Windows 10 22H2 (Build 19045)
  • Windows 11 21H2 (Build 22000)
  • Other (specify)

Other Windows Build number

Windows 11 23H2 (Build 22631)

App minimum and target SDK version

  • Windows 10, version 1809 (Build 17763)
  • Windows 10, version 1903 (Build 18362)
  • Windows 10, version 1909 (Build 18363)
  • Windows 10, version 2004 (Build 19041)
  • Windows 10, version 2104 (Build 20348)
  • Windows 11, version 22H2 (Build 22000)
  • Other (specify)

Other SDK version

Windows 11 ? (Build 22621)

Visual Studio Version

2022

Visual Studio Build Number

17.12.1

Device form factor

Desktop

Additional context

I tried to use TrimmerRootDescriptor in my project file to preserve all things in CommunityToolkit.WinUI.Controls.SettingsControls

<linker>
    <assembly fullname="CommunityToolkit.WinUI.Controls.SettingsControls" preserve="all"/>
</linker>

But it don't work.

Help us help you

No, I'm unable to contribute a solution.

@TheJoeFin
Copy link

Related to #498

@michael-hawker michael-hawker added the bug Something isn't working label Nov 25, 2024
@Arlodotexe Arlodotexe moved this to 🆕 New in Toolkit 8.x Nov 25, 2024
@michael-hawker
Copy link
Member

michael-hawker commented Nov 25, 2024

@Baka632 can you please let us know what version of the WASDK and Toolkit you are trying to use this on?

I am unable to reproduce this issue on my machine using AOT in debug and release mode, with/without debugger attached:
Image

You need to be using the latest preview for AOT support of the Toolkit - 8.2.241112-preview1.

    <PackageReference Include="CommunityToolkit.WinUI.Controls.SettingsControls" Version="8.2.241112-preview1" />
    <PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.1742" />
    <PackageReference Include="Microsoft.WindowsAppSDK" Version="1.6.241114003" />

@Baka632
Copy link
Author

Baka632 commented Nov 26, 2024

@Baka632 can you please let us know what version of the WASDK 和 Toolkit you are trying to use this on?

I am unable to reproduce this issue on my machine using AOT in debug 和 release mode, with/without debugger attached: Image

You need to be using the latest preview for AOT support of the Toolkit - 8.2.241112-preview1

<PackageReference Include="CommunityToolkit.WinUI.Controls.SettingsControls" Version="8.2.241112-preview1" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.1742" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.6.241114003" />

I am using the latest stable version of Toolkit: 8.1.240916 (and WASDK 1.6.241114003).
After updating to latest preview version of Toolkit, I solved this problem, thanks to your reply!

@Baka632 Baka632 closed this as completed Nov 26, 2024
@github-project-automation github-project-automation bot moved this from 🆕 New to ✅ Done in Toolkit 8.x Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working need more info 📌
Projects
Status: Done
Development

No branches or pull requests

3 participants