Skip to content

PublishAot with Segmented control crash at runtime #536

@0x7c13

Description

@0x7c13

Describe the bug

These are the versions I am using (all up to date)
CommunityToolkit.WinUI.Controls.HeaderedControls" Version="8.1.240916"
CommunityToolkit.WinUI.Controls.Primitives" Version="8.1.240916"
CommunityToolkit.WinUI.Controls.RangeSelector" Version="8.1.240916"
CommunityToolkit.WinUI.Controls.Sizers" Version="8.1.240916"
CommunityToolkit.WinUI.Controls.SettingsControls" Version="8.1.240916"
CommunityToolkit.WinUI.Controls.Segmented" Version="8.1.240916"
CommunityToolkit.WinUI.Converters" Version="8.1.240916"
CommunityToolkit.WinUI.Animations" Version="8.1.240916"

Microsoft.Windows.CsWinRT" Version="2.1.6"
Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.1742"
Microsoft.WindowsAppSDK" Version="1.6.240923002"

And I set this in the csproj:
PublishAot->True

For release build, as long as I click on a Page that contains Segmented control, it crashes. Maybe it has something to do with introducing xmlns:controls="using:CommunityToolkit.WinUI.Controls" in the xaml?

The error is very generic (like always:():
Failed to assign to property 'Microsoft.UI.Xaml.ResourceDictionary.Source' because the type 'Windows.Foundation.String' cannot be assigned to the type 'Windows.Foundation.Uri'.

Steps to reproduce

It should be easy to reproduce, just create a new app with PublishAot set to true. Add Segmented control to the home page and run under release mode.

Expected behavior

App should not crash.

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 24H2 (Build 26100)

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

<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>     <TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion> 	<WindowsSdkPackageVersion>10.0.22621.38</WindowsSdkPackageVersion>

Visual Studio Version

2022

Visual Studio Build Number

No response

Device form factor

Desktop

Additional context

No response

Help us help you

No, I'm unable to contribute a solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    nativeaotThe dependency on dotnet NativeAOT

    Type

    No type

    Projects

    Status

    ✅ Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions