none
AdvanceBy object reference error

    Question

  • Hi,

    I have an WPF app that is using the TestScheduler and although for the most part it works, I randomly get the same error:

    App.CurrentDomain_UnhandledException Error Object reference not set to an instance of an object. :    at System.Reactive.PriorityQueue`1.IndexedItem.CompareTo(IndexedItem other)
       at System.Reactive.PriorityQueue`1.IsHigherPriority(Int32 left, Int32 right)
       at System.Reactive.PriorityQueue`1.Percolate(Int32 index)
       at System.Reactive.PriorityQueue`1.Enqueue(T item)
       at System.Reactive.Concurrency.VirtualTimeScheduler`2.ScheduleAbsolute[TState](TState state, TAbsolute dueTime, Func`3 action)
       at Microsoft.Reactive.Testing.TestScheduler.ScheduleAbsolute[TState](TState state, Int64 dueTime, Func`3 action)
       at System.Reactive.Concurrency.VirtualTimeSchedulerBase`2.Schedule[TState](TState state, Func`3 action)
       at System.Reactive.Concurrency.Scheduler.Schedule[TState](IScheduler scheduler, TState state, Action`2 action)
       at System.Reactive.ScheduledObserver`1.EnsureActiveSlow()
       at System.Reactive.ObserveOnObserver`1.OnNextCore(T value)
       at System.Reactive.ObserverBase`1.OnNext(T value)
       at System.Reactive.Linq.Observable.Timer.p.Tick(Int64 count)
       at System.Reactive.Concurrency.DefaultScheduler.<>c__DisplayClass9`1.<SchedulePeriodic>b__7()
       at System.Reactive.Concurrency.AsyncLock.Wait(Action action)
       at System.Reactive.Concurrency.DefaultScheduler.<>c__DisplayClass9`1.<SchedulePeriodic>b__6()
       at System.Reactive.Concurrency.ConcurrencyAbstractionLayerImpl.PeriodicTimer.Tick(Object state)
       at System.Threading.TimerQueueTimer.CallCallbackInContext(Object state)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.TimerQueueTimer.CallCallback()
       at System.Threading.TimerQueueTimer.Fire()
       at System.Threading.TimerQueue.FireNextTimers()
       at System.Threading.TimerQueue.AppDomainTimerCallback()

    This really isn't helping in figuring out the error so I was wondering if anyone has seen this before and hopefully figured out the cause.

    I'm using 2.1.30214.0 of RX in .net 4.5.

    This never happens while debugging and only randomly at runtime.

    I'm reading a file with timestamps in it and doing TestScheduler.AdvanceBy(xx) for the timestamp difference between the lines in the file.

    Cheers,

      nisbus


    Thanks, nisbus

    Friday, November 08, 2013 6:48 PM