Skip to content

iOS app crashes on release mode when performing a .Sum on a List of 20k+ items #97625

@andyx48

Description

@andyx48

Description

Our production app is crashing without leaving any stacktrace when performing a .Sum or .Average on a List of ~20k items in release mode.

When manually performing the operation in a foreach instead of using .Sum, works as expected.

I have also tried to replicate the .Sum method on my code to see where the issue arises, and it seems that the use of Generics is what is making the app to crash, when changing the generics data types to defined data types, the app does not crash.

I have attached a basic reproduction app.

Steps to Reproduce

  1. Create a new dotnet MAUI app.
  2. Create a List of a custom model with one of the properties being a decimal.
  3. Add 20k elements to the list.
  4. Perform a List.Sum(x=>x.DecimalProperty)

Expected result:
To perform the sum of the items.

Actual results:
The app crashes when attempting to perform the operation, but only on Release mode, works as expected when on Debug mode

Link to public reproduction project repository

https://github.com/andyx48/GenericsCrashRepro

Version with bug

8.0.3

Is this a regression from previous behavior?

Yes, this used to work in Xamarin.Forms

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

iOS 15 and up to the latest version

Did you find any workaround?

No

Relevant log output

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions