You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I know that AsyncRx is not yet officially supported, but I tried it because I'm currently working in a pure async environment. It works well for the few things I did so far, but I discovered one issue where I don't know how to solve it.
On mouse up (the stop observable) I get sometimes the following exception:
System.InvalidOperationException
HResult=0x80131509
Message=The observer has already terminated.
Source=System.Reactive.Async.Core
StackTrace:
at System.Reactive.AsyncObserverBase`1.TryEnter()
at System.Reactive.AsyncObserverBase`1.OnNextAsync(T value)
at System.Reactive.Linq.AsyncObserver.<>c__DisplayClass421_0`2.<<TakeUntil>b__0>d.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Reactive.AsyncObservableBase`1.AutoDetachAsyncObserver.<OnNextAsyncCore>d__10.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Reactive.Linq.AsyncObserver.<>c__DisplayClass343_0`2.<<Select>b__0>d.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Reactive.AsyncObservableBase`1.AutoDetachAsyncObserver.<OnNextAsyncCore>d__10.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Reactive.Linq.AsyncObserver.<>c__DisplayClass341_0`2.<<Scan>b__0>d.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Reactive.AsyncObservableBase`1.AutoDetachAsyncObserver.<OnNextAsyncCore>d__10.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Reactive.AsyncObservableBase`1.AutoDetachAsyncObserver.<OnNextAsyncCore>d__10.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Reactive.Linq.AsyncObserver.<>c__DisplayClass343_0`2.<<Select>b__0>d.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Reactive.AsyncObservableBase`1.AutoDetachAsyncObserver.<OnNextAsyncCore>d__10.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at FabricClassLibrary.FabricEvent`1.<>c__DisplayClass11_0.<<CreateEventStream>b__1>d.MoveNext() in
What happens is quite clear. There is a new mouse move incoming while the mouse up already signaled the completion of the inner observable. I wonder whether there's a way to solve it. Since the exception comes from a Try.. method 'TryEnter', I adapted the AsyncRx code temporarily, so that TryEnter returns true/false for success / non success.
privateboolTryEnter(boolthrowException){varold= Interlocked.CompareExchange(ref _status, Busy, Idle);switch(old){case Busy:{if(throwException){thrownew InvalidOperationException("The observer is currently processing a notification.");}returnfalse;}case Done:{if(throwException){thrownew InvalidOperationException("The observer has already terminated.");}returnfalse;}}returntrue;}
With that little change everything works fine without any exception. I just wonder whether I could avoid the exception somehow without modifying the AsyncRx library code itself.
The text was updated successfully, but these errors were encountered:
I know that AsyncRx is not yet officially supported, but I tried it because I'm currently working in a pure async environment. It works well for the few things I did so far, but I discovered one issue where I don't know how to solve it.
I created a drag / pan observable:
On mouse up (the stop observable) I get sometimes the following exception:
What happens is quite clear. There is a new mouse move incoming while the mouse up already signaled the completion of the inner observable. I wonder whether there's a way to solve it. Since the exception comes from a Try.. method 'TryEnter', I adapted the AsyncRx code temporarily, so that TryEnter returns true/false for success / non success.
With that little change everything works fine without any exception. I just wonder whether I could avoid the exception somehow without modifying the AsyncRx library code itself.
The text was updated successfully, but these errors were encountered: