RxUI and ExecutionContext #2899
Unanswered
ScarletKuro
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello.
I have problem with AsyncLocal and RxUI.
In my WPF app I'm using AsyncLocal to store TCP session, and sometimes in the ViewModel inside the ReactiveCommand I need to get the data from the AsyncLocal and I noticed that it's not consistent. And I have similar issue like here, another example.
And article about the problem, I have pretty much the same requirements from the "The Problem" header.
Is there some workaround for it to make ReactiveCommand to capture the correct execution context?
I can try to make repro if it's needed, but they way I caught the problem was following. I made an unique id for each TCP session, and I log the Id outside of the Rx in the ctor of VM(its called every time the form was opened, and the form opens each time when TCP session was received) and then inside the ReactiveCommand. When those values match, everything is cool, but when not it's a problem, because it's using the data from the wrong session.
Correct
Wrong
I understand that this is a corner case, but hope that someone has an idea. For example, if someone used OpenTelemetry that relies on the AsyncLocal too, and would log something inside the ReactiveCommand, then the person would encounter the same problem.
Beta Was this translation helpful? Give feedback.
All reactions