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

Threading Issue #14

Open
josephnarai opened this issue Dec 30, 2021 · 0 comments
Open

Threading Issue #14

josephnarai opened this issue Dec 30, 2021 · 0 comments

Comments

@josephnarai
Copy link

josephnarai commented Dec 30, 2021

Hi and thanks for your great open source project!

I've been using a SynchronizedObservableCollection and came across a strange threading / race condition... it only happens on certain machines, so I'm guessing it's a speed issue or something - or I'm just misunderstanding how it's supposed to operate.

I have calls to Add and Remove happening on different threads, and I'm seeing the following:

Main thread (UI) calls Add(item) but seems to take some time to return... and during this time, if the background thread tries to call Remove(item) ... I get the InvalidOperationException("SynchronizedObservableCollection reentrancy not allowed"); which makes sense, it's inside Add when Remove is being called...

I got around this issue by adding a queue for adding and removing items, but am not sure if there would be better way to handle this? I tried locking around the Add / Remove calls, but then I just found that the call to Add that takes a long time just never returns... so am confused by what's happening...

Is there a different way of handling the calls from multiple threads?

I've not tried to make a simple test project to reproduce it, but thought I'd let you know in case it was something obvious...

Thanks again,

Joseph

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

No branches or pull requests

1 participant