anchor.diff:            p.Reset()
             if !observerStarted then
               this.onNextEvent.Publish.RemoveHandler(onNextHandler)
  +            this.onCompletedEvent.Publish.RemoveHandler(onCompletedHandler)
       }
   
     member this.GetAt(idx:int) = if idx >= 0 && idx < this.size then this.values.[idx] else raise (ArgumentOutOfRangeException("idx", "Idx is out of range in SortedMap GetAt method."))
  
positive.code: 
  and
    internal SortedMapCursor<'K,'V> =
      //struct
      val public source : SortedMap<'K,'V>
      val mutable index : int
      val mutable currentKey : 'K
      val mutable currentValue: 'V
      val mutable cursorVersion : int
      val mutable isBatch : bool
  
      val mutable isSubscribed : bool
      val mutable tcs :  TaskCompletionSource<bool> //AsyncTaskMethodBuilder<bool>
      val mutable cancellationToken : CancellationToken 
      val mutable cancellationTokenRegistration : CancellationTokenRegistration
      [<DefaultValueAttribute(false)>]
      val mutable onNextHandler : OnNextHandler<'K,'V>
      [<DefaultValueAttribute(false)>]
      val mutable onCompletedHandler : OnCompletedHandler
      [<DefaultValueAttribute(false)>]
      val mutable onErrorHandler : OnErrorHandler
  
      new(source:SortedMap<'K,'V>) = 
        { source = source; 
          index = -1;
          currentKey = Unchecked.defaultof<_>;
          currentValue = Unchecked.defaultof<_>;
          cursorVersion = source.orderVersion;
          isBatch = false;
          isSubscribed = false;
          tcs = Unchecked.defaultof<_>;
          cancellationToken = Unchecked.defaultof<_>;
          cancellationTokenRegistration  = Unchecked.defaultof<_> ;
  
        }
      //end 
  //    member this.ONH(kvp:KVP<'K,'V>) =
  //      SortedMapCursor<'K,'V>.OnNext(&this, kvp)
  
      static member private OnNext(cursor:SortedMapCursor<'K,'V>, kvp:KVP<'K,'V>) : unit =
        // we do not use kvp for now and ignore out of order data
        // MoveNext + versions handling should handle this
        let entered = enterLockIf cursor.source.SyncRoot true
        try
          if cursor.tcs <> Unchecked.defaultof<_> then
            let mutable localtcs = cursor.tcs
            cursor.tcs <- Unchecked.defaultof<_>
            try
              if cursor.MoveNext() then 
                localtcs.SetResult(true)
            with
            | _ as ex -> localtcs.SetException(ex)
          //else do nothing
        finally
          exitLockIf cursor.source.SyncRoot entered
  
      // temp solution, this implementation them checks IsMutable property
      static member private OnCompleted(cursor:SortedMapCursor<'K,'V>) = 
        let entered = enterLockIf cursor.source.SyncRoot true
        try
          if cursor.tcs <> Unchecked.defaultof<_> then
            let mutable localtcs = cursor.tcs
            cursor.tcs <- Unchecked.defaultof<_>
            try
              if cursor.MoveNext() then localtcs.SetResult(true)
              else localtcs.SetResult(false)
            with
            | _ as ex -> localtcs.SetException(ex)
          //else do nothing
        finally
          exitLockIf cursor.source.SyncRoot entered
  
      static member private OnError(this:SortedMapCursor<'K,'V>, e:exn) = 
        let entered = enterLockIf this.source.SyncRoot true
        try
          if this.tcs <> Unchecked.defaultof<_> then
            let mutable localtcs = this.tcs
            this.tcs <- Unchecked.defaultof<_>
            localtcs.SetException(e)
          //else do nothing
        finally
          exitLockIf this.source.SyncRoot entered
        
      member this.Comparer: IComparer<'K> = this.source.Comparer
      member this.TryGetValue(key: 'K, value: byref<'V>): bool = this.source.TryGetValue(key, &value)
      member this.MoveNext() =
  
negative.code:           | _ -> failwith "Unknown AppendOption"
          finally
            exitLockIf this.SyncRoot entered
      
    //#endregion
  
  