diff --git a/src/Uno.Extensions.Reactive.UI/Presentation/Bindings/BindableEnumerable.cs b/src/Uno.Extensions.Reactive.UI/Presentation/Bindings/BindableEnumerable.cs index d13b00cb60..df902ad7e2 100644 --- a/src/Uno.Extensions.Reactive.UI/Presentation/Bindings/BindableEnumerable.cs +++ b/src/Uno.Extensions.Reactive.UI/Presentation/Bindings/BindableEnumerable.cs @@ -33,7 +33,7 @@ public abstract class BindableEnumerable : Bi private readonly BindablePropertyInfo _listProperty; private readonly Func, TBindableItem> _bindableFactory; - private readonly Visitor _visitor; + private Visitor? _visitor; /// /// Creates a new instance @@ -47,7 +47,6 @@ private protected BindableEnumerable( { _listProperty = property; _bindableFactory = bindableFactory; - _visitor = new Visitor(this); } private protected abstract CollectionChangeSet GetChanges(TCollection previous, TCollection current); @@ -58,7 +57,7 @@ private protected override void UpdateSubProperties(TCollection previous, TColle { var collectionChanges = (changes as CollectionChangeSet ?? GetChanges(previous, current)); base.UpdateSubProperties(previous, current, collectionChanges); - collectionChanges.Visit(_visitor); + collectionChanges.Visit(_visitor ??= new(this)); } #region IList (read-only)