CommunityToolkit / Windows

Collection of controls for WinUI 2, WinUI 3, and Uno Platform developers. Simplifies and demonstrates common developer tasks building experiences for Windows with .NET.
https://aka.ms/windowstoolkitdocs
Other
596 stars 74 forks source link

StaggeredLayout crashes on ARM64 build #542

Open euju-ms opened 2 months ago

euju-ms commented 2 months ago

Describe the bug

The StaggeredLayout from the new namespace CommunityToolkit.WinUI.Controls.Primitives crashes on ARM64 build when used in an ItemsView with the following StackTace:

Message = "Array dimensions exceeded supported range."

   at CommunityToolkit.WinUI.Controls.StaggeredLayout.MeasureOverride(VirtualizingLayoutContext context, Size availableSize)
   at Microsoft.UI.Xaml.Controls.VirtualizingLayout.Microsoft.UI.Xaml.Controls.IVirtualizingLayoutOverrides.MeasureOverride(VirtualizingLayoutContext context, Size availableSize)
   at ABI.Microsoft.UI.Xaml.Controls.IVirtualizingLayoutOverrides.Do_Abi_MeasureOverride_2(IntPtr thisPtr, IntPtr context, Size availableSize, Size* result)

Note that the sample app also crashes if you go to the StaggeredLayout page (IF you are on ARM64 device).

Regression

No response

Reproducible in sample app?

Steps to reproduce

1. Build and run the sample app on ARM64.
2. Observe the crash.

Here's the link for the sample app: https://github.com/euju-ms/StaggeredLayoutArm64

The code basically uses the StaggeredLayout in ItemsView.

<ItemsView ...>

    <ItemsView.Layout>
        <tkControls:StaggeredLayout />
    </ItemsView.Layout>
</ItemsView>

Expected behavior

Expected to see three items show up instead of crashing.

Screenshots

Following three blue squares should show when it works; but using the newest StaggeredLayout crashes the app immediately.

image

Windows Build Number

Other Windows Build number

Windows 11 24H2 (Build 26100.1742)

App minimum and target SDK version

Other SDK version

No response

Visual Studio Version

2022

Visual Studio Build Number

Version 17.11.3

Device form factor

Desktop

Nuget packages

<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.756" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.6.240829007" />
<PackageReference Include="CommunityToolkit.WinUI.Controls.Primitives" Version="8.1.240916" />

Additional context

I set WindowsSdkPackageVersion of 10.0.22621.45 for WinAppSdk 1.6 to work (but I verified that the issue persists without this in WinAppSdk 1.5.240802000).

I have also verified that the StaggeredLayout from the old package CommunityToolkit.WinUI.UI.Controls version 7.1.2 works.

Help us help you

No.

euju-ms commented 2 months ago

Just updated the original post to say that the sample app crashes if you go to StaggeredLayout page from ARM64 device.

Here's the log message from Event Viewer

Faulting application name: CommunityToolkit.App.Uwp.exe, version: 0.0.0.0, time stamp: 0x66b3a419
Faulting module name: Windows.UI.Xaml.dll, version: 10.0.26100.1742, time stamp: 0x4d542ab4
Exception code: 0xc000027b
Fault offset: 0x000000000087dd8c
Faulting process id: 0x627C
Faulting application start time: 0x1DB0ED3BE9D2735
Faulting application path: C:\Program Files\WindowsApps\Microsoft.UWPCommunityToolkitSampleApp_8.1.0.0_arm64__8wekyb3d8bbwe\CommunityToolkit.App.Uwp.exe
Faulting module path: C:\Windows\System32\Windows.UI.Xaml.dll
Report Id: 5cdfe141-e798-4c5c-b463-7b7985bd673f
Faulting package full name: Microsoft.UWPCommunityToolkitSampleApp_8.1.0.0_arm64__8wekyb3d8bbwe
Faulting package-relative application ID: App
Arlodotexe commented 1 week ago

@michael-hawker any ideas here?