Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug/fix invalid operation exception with multi threading #266

Conversation

HeedfulCrayon
Copy link
Contributor

@HeedfulCrayon HeedfulCrayon commented Oct 3, 2023

Description

Made the DialogService capable of spanning multiple STA threads.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works

@FantasticFiasco FantasticFiasco force-pushed the bug/FixInvalidOperationExceptionWithMultiThreading branch from b100cee to 9d0228d Compare October 5, 2023 20:12
@FantasticFiasco
Copy link
Owner

Got hung up on other things but am back. Am focusing on the implementation using the concurrent dictionary. To bad there isn't a thread safe list instead, we now introduce some situations where previously we threw an error if we failed to modify the registered views where we now instead only log. I'll look more on this during the weekend.

Btw, thank you for your patience, I haven't been able to dedicate the time this requires.

@FantasticFiasco
Copy link
Owner

I refactored the code to use a simple locked list instead of the concurrent dictionary. The list is slower but I hope this is insignificant since registering and unregistering views doesn't happen that often, however I haven't benchmarked it. I was hesitant to use the dictionary since it introduced new behaviors where it logged the errors instead of plainly crashing the application.

Thank you for bringing this issue to my attention, and for contributing the actual fix, that is just awesome!

I've updated CHANGELOG.md to highlight that it was a contribution from you.

@FantasticFiasco FantasticFiasco merged commit ad75753 into FantasticFiasco:master Oct 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

InvalidOperationException when multiple UI threads are used
2 participants