[0.20] Crash when using indexOf replaceAt



My app is crashing with error :

ERROR: Index was out of range. Must be non-negative and less than the size of the collection.
    Parameter name: index
    System.ArgumentOutOfRangeException occured.
      at System.ThrowHelper.ThrowArgumentOutOfRangeException () [0x00000] in <filename unknown>:0 
      at System.Collections.Generic.List1[System.Collections.Generic.List1[Fuse.Node]].get_Item (Int32 index) [0x00000] in <filename unknown>:0 
      at Fuse.Reactive.Each.Fuse.Reactive.IObserver.OnNewAt (Int32 index, System.Object value) [0x00000] in <filename unknown>:0 
      at Uno.Threading.IDispatcherExtensions+Arg2Invoke`2[System.Int32,System.Object].Run () [0x00000] in <filename unknown>:0 
      at Fuse.Reactive.Dispatcher.Run () [0x00000] in <filename unknown>:0 
      at Fuse.UpdateListener.Invoke () [0x00000] in <filename unknown>:0 
      at Fuse.UpdateManager.Update (Fuse.Stage stage) [0x00000] in <filename unknown>:0

I think the crash occurs when trying to use replaceAt() on a observer that has been clear() in the meantime.


Thanks for the report. I’ve added this thread to an internal ticket that covers cleanup of error handling in connection with Observables.

In the meantime a simple workaround is to add an aditionnal check like :

if(my_observable.contains(item)) {
  my_observable.replaceAt(my_observable.indexOf(searchedIteam), item);