I have this line in my backgroundWorker thread:
Dispatcher.CurrentDispatcher.BeginInvoke((Action)(() => this.Network.Nodes.Add(node))).Wait();
I'm getting an exception InvalidOperationException from it.
I have this line in my backgroundWorker thread:
Dispatcher.CurrentDispatcher.BeginInvoke((Action)(() => this.Network.Nodes.Add(node))).Wait();
I'm getting an exception InvalidOperationException from it.
I would imagine that
BeginInvoke(...).Wait()
would deadlock if you are currently on the UI thread. Try using Invoke
instead.