Closed marklam closed 3 years ago
The upper bound at https://github.com/fsprojects/Fabulous/blob/c442b48c9e30bad413948298b5bee1be2a455291/Fabulous.XamarinForms/src/Fabulous.XamarinForms/Collections.fs#L41-L42 is too high, and the arr.[i + 1] will attempt to read outside the array.
arr.[i + 1]
Happens from Collections.diff at https://github.com/fsprojects/Fabulous/blob/c442b48c9e30bad413948298b5bee1be2a455291/Fabulous.XamarinForms/src/Fabulous.XamarinForms/Collections.fs#L140 with a 16-element array, reusableIndex = 0 reusableElementsCount = 16, discardedElementsCount = 0, identicalElements is empty.
Item is removed
Exception is thrown, and swallowed by WPF
@marklam Thanks for the precise report It helped me find the real reason why we did not see it before, and write a unit test to catch this specific case. I will release a new version with this fix.
Description
The upper bound at https://github.com/fsprojects/Fabulous/blob/c442b48c9e30bad413948298b5bee1be2a455291/Fabulous.XamarinForms/src/Fabulous.XamarinForms/Collections.fs#L41-L42 is too high, and the
arr.[i + 1]
will attempt to read outside the array.Steps to Reproduce
Happens from Collections.diff at https://github.com/fsprojects/Fabulous/blob/c442b48c9e30bad413948298b5bee1be2a455291/Fabulous.XamarinForms/src/Fabulous.XamarinForms/Collections.fs#L140 with a 16-element array, reusableIndex = 0 reusableElementsCount = 16, discardedElementsCount = 0, identicalElements is empty.
Expected Behavior
Item is removed
Actual Behavior
Exception is thrown, and swallowed by WPF
Basic Information