Potential Concurrency Issue in Stylet Framework #380
Unanswered
TreatTrick
asked this question in
Q&A
Replies: 2 comments 1 reply
-
The deadlock is:
There are a number of things which came together here:
The correct approach is to call I will also fix the EventAggregator to not call handlers while holding a lock. |
Beta Was this translation helpful? Give feedback.
1 reply
-
Fixed in #390 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello Stylet team,
I'm writing to bring to your attention a potential issue with the Stylet Framework that I've encountered while developing an application using your library.
Here is the sample code to reproduce the issue:
The issue arises when the Test() method is called. the UI hangs after printing "Before Clear, thread: 3" in the console. This seems to suggest a concurrency problem, as the UI thread appears to be waiting indefinitely for something to complete.
Interestingly, if the Test() function is replaced with code below, which uses another "Task.Run" to replace the direct _eventAggregato call, the UI doesn't hang. This seems to suggest that the issue is specifically related to the two thread, one UI tread and another one background thread, handling the property "TestModels" at the same time.
This issue is critical for my application, and I'd appreciate any insights you might have into why it's occurring and how it might be resolved. I also attached the project, so any one who wants to test the code could download and run it.TestCode.zip
Thank you for your time and for developing such a useful library!
Best regards,
Xq Sora
Beta Was this translation helpful? Give feedback.
All reactions