Grid.RowSpan="0" throws exception in release mode, but not debug mode
- Dominant language
- C#
- Stars
- 23.3k
- Forks
- 2k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 290
Description
### Description
If you have an element with the attribute `Grid.RowSpan="0"` an exception is thrown in release mode on Android, but not debug mode. This makes it very hard to detect and troubleshoot.
On WIndows the application will crash in debug mode if error is on the primary page. But it crashes only in release mode if the error occurs after navigation.
This is somewhat related: https://github.com/dotnet/maui/issues/6171
### Steps to Reproduce
1. Create new MAUI application.
2. Add this in MainPage.xaml:
``` XAML
```
3. Add this in MainPage.xaml.cs:
``` C#
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
}
private async void OnCounterClicked(object sender, EventArgs e)
{
await Navigation.PushAsync(new SecondPage());
}
}
```
4. Add SecondPage.xaml with this content:
``` XAML
```
5. To save this, add this into .csproj:
``` XML
false
false
```
6. Run the application in debug mode. No exception will be thrown.
7. Run the application in release mode on Android and Windows. The application will crash.
### Link to public reproduction project repository
https://github.com/pekspro/MauiIssues/tree/11486_Grid_RowSpan_0_throws_exception_in_release_mode
### Version with bug
7.0 (current)
### Last version that worked well
Unknown/Other
### Affected platforms
Android, I was *not* able test on other platforms
### Affected platform versions
Android 11
### Did you find any workaround?
Use a valid RowSpan value :-)
### Relevant log output
```shell
System.ArgumentException: Value is an invalid value for RowSpan (Parameter 'value')
at Microsoft.Maui.Controls.BindableObject.SetValueCore(BindableProperty property, Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes)
at Microsoft.Maui.Controls.BindableObject.SetValue(BindableProperty property, Object value, Boolean fromStyle, Boolean checkAccess)
at Microsoft.Maui.Controls.BindableObject.SetValue(BindableProperty property, Object value)
```
Contributor guide
Research direction
Start with the reproduction project linked in the issue and compare debug and release runs using MainPage.xaml, MainPage.xaml.cs, SecondPage.xaml, and the .csproj settings shown. Trace the RowSpan="0" exception and determine why its behavior differs by configuration and platform; done means the reported reproduction behaves consistently and no longer crashes unexpectedly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, csharp
- Domain
- frontend, mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100