anchor.diff:      member ac.WaitForConnectionAsync (timeout : TimeSpan) : Task<bool> =
           
           let doneSignal = new ManualResetEventSlim(false)
  -        let reachedState = ref false
  -
  -        // TODO race conditions on destruction
  +        let mutable reachedState = false
  +
           let sub = ac.ConnectionState.Subscribe(fun state ->
                           match state with
                           | ConnectionState.Connected (_ip, _cmdLink) ->
  -                            reachedState := true
  +                            reachedState <- true
                               doneSignal.Set() |> ignore
                           | _ -> ())
   
           Async.StartAsTask(async {
  -            doneSignal.Wait(timeout) |> ignore
  -            sub.Dispose()
  -            return !reachedState
  +            try
  +                let disposingHandle = disposingSignal.WaitHandle // Keep a copy in case of dispose race condition
  +                let waitHandles = [| doneSignal.WaitHandle; disposingHandle |]
  +
  +                match WaitHandle.WaitAny(waitHandles, timeout) with
  +                | WaitHandle.WaitTimeout -> ()
  +                | idx when waitHandles.[idx] = disposingHandle ->
  +                    raise (ObjectDisposedException "SonarConduit was disposed while waiting for a state change")
  +                | _ -> ()
  +            finally
  +                sub.Dispose()
  +
  +            return reachedState
           })
   
       member __.Metrics = makeMetrics instantaneousFrameRate.Value frameStreamListener.Metrics
  
positive.code: 
      interface IDisposable with
          member __.Dispose() =
              let disposables = List.concat [ queueLinks; inputGraphLinks; pGraphDisposables
                                              [ focusInputSubscription; earlyFrameSubject; frameStreamSubscription
                                                frameStreamListener; snListener; cxnStateSubject; cts; cxnMgrDone ] ]
  
negative.code:                            perfSink : ConduitPerfSink) as self =
  
      let disposed = ref false
      let disposingSignal = new ManualResetEventSlim()
      let mutable serialNumber: Nullable<SerialNumber> = Nullable<SerialNumber>()
      let mutable snListener: IDisposable = null
      let mutable setSalinity: (Frame -> unit) = fun _ -> ()
  