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

[BUG] IndexToArrayItemConverter CTD #2404

Open
2 tasks done
ne0rrmatrix opened this issue Dec 20, 2024 · 0 comments
Open
2 tasks done

[BUG] IndexToArrayItemConverter CTD #2404

ne0rrmatrix opened this issue Dec 20, 2024 · 0 comments
Labels
bug Something isn't working unverified

Comments

@ne0rrmatrix
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

Did you read the "Reporting a bug" section on Contributing file?

Current Behavior

When running sample app and navigating to converters then to IndexToArrayItemConverter Page and clicking on increasing item it will go out of bounds with the following stacktrace.

   at CommunityToolkit.Maui.Converters.IndexToArrayItemConverter.ConvertFrom(Int32 value, Array parameter, CultureInfo culture) in C:\Users\james\source\repos\MauiOld\src\CommunityToolkit.Maui\Converters\IndexToArrayItemConverter.shared.cs:line 31
   at CommunityToolkit.Maui.Converters.BaseConverter`3.CommunityToolkit.Maui.Converters.ICommunityToolkitValueConverter.Convert(Object value, Type targetType, Object parameter, CultureInfo culture) in C:\Users\james\source\repos\MauiOld\src\CommunityToolkit.Maui\Converters\BaseConverter.shared.cs:line 96
   at CommunityToolkit.Maui.Converters.ICommunityToolkitValueConverter.Microsoft.Maui.Controls.IValueConverter.Convert(Object value, Type targetType, Object parameter, CultureInfo culture) in C:\Users\james\source\repos\MauiOld\src\CommunityToolkit.Maui\Converters\ICommunityToolkitValueConverter.shared.cs:line 57
   at Microsoft.Maui.Controls.BindingExpression.ApplyCore(Object sourceObject, BindableObject target, BindableProperty property, Boolean fromTarget, SetterSpecificity specificity)
   at Microsoft.Maui.Controls.BindingExpression.Apply(Boolean fromTarget)
   at Microsoft.Maui.Controls.BindingExpression.BindingExpressionPart.<PropertyChanged>b__50_0()
   at Microsoft.Maui.Controls.DispatcherExtensions.DispatchIfRequired(IDispatcher dispatcher, Action action)
   at Microsoft.Maui.Controls.BindingExpression.BindingExpressionPart.PropertyChanged(Object sender, PropertyChangedEventArgs args)
   at Microsoft.Maui.Controls.BindingExpression.WeakPropertyChangedProxy.OnPropertyChanged(Object sender, PropertyChangedEventArgs e)
   at CommunityToolkit.Mvvm.ComponentModel.ObservableObject.OnPropertyChanged(PropertyChangedEventArgs e)
   at CommunityToolkit.Maui.Sample.ViewModels.Converters.IndexToArrayItemConverterViewModel.set_SelectedIndex(Int32 value) in C:\Users\james\source\repos\MauiOld\samples\CommunityToolkit.Maui.Sample\obj\Debug\net9.0-windows10.0.19041.0\win10-x64\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\CommunityToolkit.Maui.Sample.ViewModels.Converters.IndexToArrayItemConverterViewModel.g.cs:line 25
   at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

The video below shows what happens.

2024-12-19.16-45-24.mp4

Expected Behavior

The sample app should not crash and not allow you to go out of range.

Steps To Reproduce

  1. Open sample app.
  2. Navigate to IndexToArrayItemConverterPage
  3. Click on increase button 8 times.
  4. App will crash.

Link to public reproduction project repository

https://github.com/CommunityToolkit/Maui/tree/main/samples

Environment

- .NET MAUI CommunityToolkit: 10.0.0
- OS: Windows 10 Build 10.0.19041.0
- .NET MAUI: 9.0.21

Anything else?

The crash is an index out of bounds error in the converter that is not handled correctly.

@ne0rrmatrix ne0rrmatrix added bug Something isn't working unverified labels Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working unverified
Projects
None yet
Development

No branches or pull requests

1 participant