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

Application works in Debug build but crashes in Release build when binding ImmutableArray to ItemsSource with x:Static #24384

Open
andrekoehler opened this issue Aug 22, 2024 · 3 comments
Labels
area-xaml XAML, CSS, Triggers, Behaviors platform/windows 🪟 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working

Comments

@andrekoehler
Copy link

Description

The application works in Debug build but crashes in Release build as soon as navigating to the XAML that uses x:Static to bind Picker.ItemsSource to an ImmutableArray.

Steps to Reproduce

  1. Create a new MAUI app
  2. Add SomeViewModel.cs:
namespace MauiApp1;
public class SomeViewModel
{
    public System.Collections.Immutable.ImmutableArray<string> Letters => ["A", "B", "C"];
    public static System.Collections.Immutable.ImmutableArray<string> StaticLetters => ["A", "B", "C"];
}
  1. Add this to MainPage.xaml:
        <!-- crashes only in Release build -->
        <Picker ItemsSource="{x:Static local:SomeViewModel.StaticLetters}" />

        <!-- works in Debug and Release build -->
        <!--<Picker ItemsSource="{Binding Letters}" />-->
  1. Select Release build and run the app on Windows Machine
  2. The app will immediately crash if the picker is on the MainPage. In my actual app it crashes as soon as I enter the page with the picker.

Link to public reproduction project repository

No response

Version with bug

8.0.61 SR6.1

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Windows, I was not able test on other platforms

Affected platform versions

net8.0-windows10.0.19041.0

Did you find any workaround?

Do not use a static property with x:Static, instead use a non-static property with Binding.

Relevant log output

Windows Event Log show the following for the crash:

- <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
- <System>
  <Provider Name="Application Error" Guid="{a0e9b465-b939-57d7-b27d-95d8e925ff57}" /> 
  <EventID>1000</EventID> 
  <Version>0</Version> 
  <Level>2</Level> 
  <Task>100</Task> 
  <Opcode>0</Opcode> 
  <Keywords>0x8000000000000000</Keywords> 
  <TimeCreated SystemTime="2024-08-22T15:10:30.0419212Z" /> 
  <EventRecordID>21892</EventRecordID> 
  <Correlation /> 
  <Execution ProcessID="36660" ThreadID="2852" /> 
  <Channel>Application</Channel> 
  <Computer>DEV</Computer> 
  <Security UserID="S-1-5-21-3321493303-1542447700-3530763417-1001" /> 
  </System>
- <EventData>
  <Data Name="AppName">MauiApp1.exe</Data> 
  <Data Name="AppVersion">1.0.0.0</Data> 
  <Data Name="AppTimeStamp">66960000</Data> 
  <Data Name="ModuleName">Microsoft.ui.xaml.dll</Data> 
  <Data Name="ModuleVersion">3.1.5.0</Data> 
  <Data Name="ModuleTimeStamp">cd7cc268</Data> 
  <Data Name="ExceptionCode">c000027b</Data> 
  <Data Name="FaultingOffset">00000000004051c5</Data> 
  <Data Name="ProcessId">0x7fc4</Data> 
  <Data Name="ProcessCreationTime">0x1daf4a56cc91dbf</Data> 
  <Data Name="AppPath">C:\dev\_test\MauiApp1\bin\Release\net8.0-windows10.0.19041.0\win10-x64\AppX\MauiApp1.exe</Data> 
  <Data Name="ModulePath">C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.5_5001.214.1843.0_x64__8wekyb3d8bbwe\Microsoft.ui.xaml.dll</Data> 
  <Data Name="IntegratorReportId">0316a482-2d1f-4afa-9ce4-490c681db1d4</Data> 
  <Data Name="PackageFullName">com.companyname.mauiapp1_1.0.0.1_x64__9zz4h110yvjzm</Data> 
  <Data Name="PackageRelativeAppId">App</Data> 
  </EventData>
  </Event>
@andrekoehler andrekoehler added the t/bug Something isn't working label Aug 22, 2024
Copy link
Contributor

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@kevinxufei kevinxufei added platform/windows 🪟 s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Aug 23, 2024
@kevinxufei
Copy link

kevinxufei commented Aug 23, 2024

I can repro this issue at Windows platform on the latest 17.12.0 Preview 1.0(8.0.80 & 8.0.61 & 8.0.40).
MauiApp22.zip

@samhouts samhouts added the area-xaml XAML, CSS, Triggers, Behaviors label Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-xaml XAML, CSS, Triggers, Behaviors platform/windows 🪟 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants
@samhouts @andrekoehler @kevinxufei and others