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

SettingsControls 8.1.240821 produces trim warnings #498

Open
3 of 24 tasks
vilgotf opened this issue Sep 6, 2024 · 1 comment
Open
3 of 24 tasks

SettingsControls 8.1.240821 produces trim warnings #498

vilgotf opened this issue Sep 6, 2024 · 1 comment

Comments

@vilgotf
Copy link

vilgotf commented Sep 6, 2024

Describe the bug

The app crashes during initialization.

Running under WinDbg reveales that the stowed exception is 0x80040154 (REGDB_E_CLASSNOTREG) with the following stack trace:

System_Private_CoreLib!System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32)+0x1b
WinRT_Runtime!WinRT.ActivationFactory.Get(System.String, System.Guid)+0x1aa
Microsoft_WinUI!Microsoft.UI.Xaml.Application.get__objRef_global__Microsoft_UI_Xaml_IApplicationStatics()+0x6b
Microsoft_WinUI!Microsoft.UI.Xaml.Application.Start(Microsoft.UI.Xaml.ApplicationInitializationCallback)+0x19
Expander_MRE!Expander_MRE.Program.Main(System.String[])+0xe4

Steps to reproduce

Create a new project from the "Blank App, Packaged (WinUI 3 in Desktop)" template and add
* CsWinRT `2.1.1`
* WindowsSdkPackageVersion `10.0.22621.38` (matching `TargetFramework`)
* SettingsControls 8.1.240821

(ensure WASDK is at version `1.6.240829007`, this was already the case for me)

Then, 
1. Add `<controls:SettingsExpander />` to `MainWindow.xaml`
2. Start the project in release mode (the template included publish profile enables `PublishedTrimmed` for release builds)
3. Crash on startup

Expected behavior

There are no trim warnings, app does not crash on startup.

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

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

No response

Visual Studio Version

2022

Visual Studio Build Number

17.11.35222.181

Device form factor

Desktop

Additional context

Discovered this issue when trying to enable NativeAOT for my project, which seems to be blocked by this issue.

Although I'm unable to reproduce the behaviour in my MRE, my original project is able to render the expander, but throws the following exception when expanding it:

System.ExecutionEngineException
  HResult=0x80131506

  This exception was originally thrown at this call stack:
    WinRT.ExceptionHelpers.ThrowExceptionForHR.__Throw|38_0(int)
    ABI.Microsoft.UI.Xaml.Controls.IStyleSelectorMethods.SelectStyle(WinRT.IObjectReference, object, Microsoft.UI.Xaml.DependencyObject)
    CommunityToolkit.WinUI.Controls.SettingsExpander.ItemsRepeater_ElementPrepared(Microsoft.UI.Xaml.Controls.ItemsRepeater, Microsoft.UI.Xaml.Controls.ItemsRepeaterElementPreparedEventArgs) in SettingsExpander.ItemsControl.cs
    ABI.Windows.Foundation.TypedEventHandlerMethods<TSender, TSenderAbi, TResult, TResultAbi>.Abi_Invoke(System.IntPtr, TSender, TResult)
    WinRT.GenericTypeInstantiations.Windows_Foundation_TypedEventHandler_2_Microsoft_UI_Xaml_Controls_ItemsRepeater__Microsoft_UI_Xaml_Controls_ItemsRepeaterElementPreparedEventArgs.Do_Abi_Invoke(System.IntPtr, System.IntPtr, System.IntPtr)

Inner Exception 1:
InvalidCastException: Specified cast is not valid.

Help us help you

Yes, but only if others can assist.

@michael-hawker
Copy link
Member

@vilgotf 8.1 was built against 1.5 and hasn't been tested against AOT scenarios yet. You'll at least want the 1.6 bits on our preview feeds: https://aka.ms/wct/wiki/previewpackages

See CommunityToolkit/Tooling-Windows-Submodule#205

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants