Here's a weird issue that I've no idea why it occurs.
The situation is as follows:
* I have a WPF application that uses a data model that my views are bound against.
* The views are presented using a ContentPresenter and DataTemplate that matches the datamodel and corresponding view.
* There are no custom threads that modify any part of the data model and/or UI.
Despite the last fact, I occasionally get the following exception:
System.InvalidOperationException: The calling thread cannot access this object because a different thread owns it.
at System.Windows.DependencyObject.GetValue(DependencyProperty dp)
at System.Windows.Controls.TextSearch.GetPrimaryText(Object item, BindingExpression primaryTextBinding, DependencyObject primaryTextBindingHome)
at System.Windows.Controls.TextSearch.GetPrimaryTextFromItem(ItemsControl itemsControl, Object item)
at System.Windows.Controls.ComboBox.OnSelectionChanged(SelectionChangedEventArgs e)
at System.Windows.Controls.Primitives.Selector.SelectionChanger.SelectJustThisItem(Object item, Boolean ass
View Complete Post