Note that there are some explanatory texts on larger screens.

plurals
  1. POThe calling thread cannot access this object because a different thread owns it
    primarykey
    data
    text
    <p>I am using a third party tool in which I get an InvalidOperationException (actually, in the end this occurs in PresentationFramework.dll):</p> <blockquote> <p>The calling thread cannot access this object because a different thread owns it.</p> </blockquote> <p>I tried any kind of variations using Invoke, including BeginInvoke, but nothing changes.</p> <blockquote> <p>Session session = new ThirdPartyTool.Session();<br> Application.Current.Dispatcher.Invoke(DispatcherPriority.Normal, (Action)(() => session.Open(view)));</p> </blockquote> <p>When using Google I only find "solutions" that suggest to use Invoke. Well, I do use Invoke.<br> Other questions and their respective answer here on stackoverflow didn't help either. </p> <p>What can I still do in order to track down the actual cause?</p> <hr> <p>Edit: I had another look into the thread window and the full call stack is in the main thread. AFAIK, this indicates the Invoke is superfluous.</p> <hr> <p>Edit2:<br> The error isn't raised directly on calling open. The ThirdPartyTool initializes a list box and when measuring this list box the error occurs in the presentation framework:</p> <p><img src="https://i.stack.imgur.com/p53uT.png" alt="enter image description here"></p> <p>The actual exception is wrapped into an XamlParseException. The full exception detail:</p> <pre><code>System.Windows.Markup.XamlParseException occurred HResult=-2146233087 Message=The calling thread cannot access this object because a different thread owns it. Source=PresentationFramework LineNumber=0 LinePosition=0 StackTrace: at System.Windows.FrameworkTemplate.LoadTemplateXaml(XamlReader templateReader, XamlObjectWriter currentWriter) InnerException: System.InvalidOperationException HResult=-2146233079 Message=The calling thread cannot access this object because a different thread owns it. Source=WindowsBase StackTrace: at System.Windows.Threading.Dispatcher.VerifyAccess() at System.Windows.Freezable.get_IsFrozen() at System.Windows.Controls.Image.UpdateBaseUri(DependencyObject d, ImageSource source) at System.Windows.Controls.Image.OnSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e) at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e) at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args) at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry&amp; newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType) at System.Windows.FrameworkTemplate.ReceivePropertySet(Object targetObject, XamlMember member, Object value, DependencyObject templatedParent) at System.Windows.FrameworkTemplate.&lt;&gt;c__DisplayClass6.&lt;LoadOptimizedTemplateContent&gt;b__4(Object sender, XamlSetValueEventArgs setArgs) at System.Xaml.XamlObjectWriter.OnSetValue(Object eventSender, XamlMember member, Object value) at System.Xaml.XamlObjectWriter.Logic_ApplyPropertyValue(ObjectWriterContext ctx, XamlMember prop, Object value, Boolean onParent) at System.Xaml.XamlObjectWriter.Logic_DoAssignmentToParentProperty(ObjectWriterContext ctx) at System.Xaml.XamlObjectWriter.Logic_AssignProvidedValue(ObjectWriterContext ctx) at System.Xaml.XamlObjectWriter.WriteEndObject() at System.Xaml.XamlWriter.WriteNode(XamlReader reader) at System.Windows.FrameworkTemplate.LoadTemplateXaml(XamlReader templateReader, XamlObjectWriter currentWriter) InnerException: null </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload