src/NetStandard/Collections/Synchronization/src/SynchronizableCollectionBase{`1}.cs
/// <summary>
/// Check and assert for reentrant attempts to change this collection.
/// </summary>
/// <exception cref="InvalidOperationException">
/// Raised when changing the collection while another collection change is still being 
/// notified to other listeners.
/// </exception>
Check and assert for reentrant attempts to change this collection.
Check and assert for reentrant attempts to change this collection .
protected void CheckReentrancy()
        {
            if (occupationMonitor.IsOccupied) {
                int invocationCount = collectionChanged?.GetInvocationList().Length ?? 0
                    + CollectionModified?.GetInvocationList().Length ?? 0;
                if (1 < invocationCount) {
                    throw new InvalidOperationException("Observable collection reentrancy is not allowed.");
                }
            }
        }
protected void CheckReentrancy ( ) { if ( occupationMonitor . IsOccupied ) { int invocationCount = collectionChanged ? . GetInvocationList ( ) . Length ?? 0 + CollectionModified ? . GetInvocationList ( ) . Length ?? 0 ; if ( 1 < invocationCount ) { throw new InvalidOperationException ( " " ) ; } } }
Check and assert for reentrant attempts to change this collection.
Check and assert for reentrant attempts to change this collection .
// Excerpt from https://github.com/microsoft/referencesource/blob/5697c29004a34d80acdaf5742d7e699022c64ecd/System/compmod/system/collections/objectmodel/observablecollection.cs: // We can allow changes if there's only one listener - the problem // only arises if reentrant changes make the original event args // invalid for later listeners.  This keeps existing code working // (e.g. Selector.SelectedItems).
Raised when changing the collection while another collection change is still being
notified to other listeners.
Raised when changing the collection while another collection change is still being notified to other listeners .