dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.16k stars 1.74k forks source link

HorizontalStackLayout Crashes Debugger on Negative Spacing #19513

Open JonesWebConsulting opened 10 months ago

JonesWebConsulting commented 10 months ago

Description

This article states that negative spacing is allowed on the HorizontalStackLayout control, however, many times this will (randomly) crash Visual Studio's debugger.

Here is my code:

<?xml version="1.0" encoding="utf-8" ?> 
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"              
    x:Class="GinRummyMAUI.MainPage">
<StackLayout>          
    <HorizontalStackLayout
        x:Name="humanCardLayout"             
        HorizontalOptions="CenterAndExpand"             
        Spacing="-5">              

    <Image                 
        x:Name="Card1"                  
        Source="back_purple.png"/>              

    <Image                 
        x:Name="Card2"                  
        Source="back_purple.png"/>           

    </HorizontalStackLayout>      
</StackLayout>  
</ContentPage>

Faulting application name: GinRummyMAUI.exe, version: 1.0.0.0, time stamp: 0x65410000 Faulting module name: Microsoft.ui.xaml.dll, version: 3.1.3.0, time stamp: 0xea4b25b7 Exception code: 0xc000027b Fault offset: 0x00000000007dc2aa Faulting process id: 0x0x4224 Faulting application start time: 0x0x1DA3288F559DEEC Faulting application path: C:\Users\syste\OneDrive\Desktop\Development\GinRummy\GinRummyMAUI\bin\Debug\net8.0-windows10.0.19041.0\win10-x64\AppX\GinRummyMAUI.exe Faulting module path: C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.3_3000.934.1904.0_x648wekyb3d8bbwe\Microsoft.ui.xaml.dll Report Id: e84bb758-64ad-49bb-be52-99b0debad0b2 Faulting package full name: com.companyname.ginrummymaui_1.0.0.1_x649zz4h110yvjzm Faulting package-relative application ID: App

Issue was also confirmed on this post.

ss

Steps to Reproduce

  1. Create a MAUI application
  2. Add the code above to the main page.

Link to public reproduction project repository

https://github.com/JonesWebConsulting/HorizontalStackLayout_MS_Issue_19513.git

Version with bug

8.0.3

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

I was not able test on other platforms

Affected platform versions

Windows 11 Home 22H2

Did you find any workaround?

Removing the negative value from spacing fixes the issue, but then does not provide the desired spacing.

Relevant log output

GinRummyMAUI.dll!GinRummyMAUI.WinUI.App.InitializeComponent.AnonymousMethod__3_1(object sender, Microsoft.UI.Xaml.UnhandledExceptionEventArgs e) Line 68 C#
ghost commented 10 months ago

Hi @JonesWebConsulting. We have added the "s/needs-repro" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/dotnet/maui/blob/main/.github/repro.md

This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

JonesWebConsulting commented 10 months ago

Repo has been added.

ghost commented 10 months ago

We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.

XamlTest commented 9 months ago

Verified this on Visual Studio Enterprise 17.9.0 Preview 2(8.0.3). Repro on Windows 11, not repro on Android 14.0-API34, iOS 17.0 and MacCatalyst with below Project: HorizontalStackLayout_19513.zip