question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[UWP] Unhandled Exception: The application called an interface that was marshalled for a different thread.

See original GitHub issue

The application called an interface that was marshalled for a different thread. (Exception from HRESULT: 0x8001010E (RPC_E_WRONG_THREAD)) is raised at the only line in the following method in WorkScheduler.cs;

protected async void TakeFromPendingTasksAndRun()
{
    await TakeFromPendingTasksAndRunAsync().ConfigureAwait(false); 
}

I have an ItemTemplate for displaying an image;

<ff:FFImage Name="Image"
                            VerticalAlignment="Stretch" 
                            HorizontalAlignment="Stretch"
                            TransformPlaceholders="False"
                            LoadingPlaceholder="ImgLoading.png"
                            ErrorPlaceholder="ImgError.png"
                            CacheDuration="30"
                            RetryCount="3"
                            RetryDelay="250"
                            DownsampleToViewSize="True"
                            DownsampleMode="Default"
                            Source="{Binding ImageUri}" />

ImageUri is a property on an object that is in an ObservableCollection<T>

Can your help? I’m lost as to how to fix this. Thanks!

Full exception detail is:

      HResult=-2147417842
      Message=The application called an interface that was marshalled for a different thread. (Exception from HRESULT: 0x8001010E (RPC_E_WRONG_THREAD))
      Source=Windows
      StackTrace:
           at Windows.UI.Xaml.DependencyObject.GetValue(DependencyProperty dp)
           at FFImageLoading.FFImage.get_SuccessCommand()
           at FFImageLoading.FFImage.OnSuccess(SuccessEventArgs e)
           at FFImageLoading.FFImage.<LoadImage>b__12_2(ImageInformation imageInformation, LoadingResult loadingResult)
           at FFImageLoading.Work.WorkScheduler.<>c__DisplayClass47_0.<CreateFrameworkTask>b__0(ImageInformation size, LoadingResult result)
           at FFImageLoading.Work.ImageLoaderTask`2.<RunAsync>d__109.MoveNext()
        --- End of stack trace from previous location where exception was thrown ---
           at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
           at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
           at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
           at FFImageLoading.Work.WorkScheduler.<RunImageLoadingTaskAsync>d__50.MoveNext()
        --- End of stack trace from previous location where exception was thrown ---
           at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
           at FFImageLoading.Work.WorkScheduler.<RunImageLoadingTaskAsync>d__50.MoveNext()
        --- End of stack trace from previous location where exception was thrown ---
           at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
           at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
           at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
           at FFImageLoading.Work.WorkScheduler.<TakeFromPendingTasksAndRunAsync>d__49.MoveNext()
        --- End of stack trace from previous location where exception was thrown ---
           at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
           at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
           at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
           at FFImageLoading.Work.WorkScheduler.<TakeFromPendingTasksAndRun>d__46.MoveNext()```

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:37 (29 by maintainers)

github_iconTop GitHub Comments

1reaction
Pseudocode99commented, Feb 19, 2017

I have the same issue in the Version 2.2.8. I downgraded Xamarin.FFImageLoading to 2.1.5 and it works now for me.

1reaction
moonClimbercommented, Jan 26, 2017

I’m going to test it between today and tomorrow… I’ll back to you really soon. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

The application called an interface that was marshalled for ...
I'm very new to C# and Windows development, but this is a very long chain of method calls, and kind of feels like...
Read more >
The application called an interface that was marshalled for ...
Hello I build UWP with Facebook Login feature. I use winsdkfb.dll for Facebook Login feature. When I click Login game throw error
Read more >
Troubleshooting porting Windows Phone Silverlight to UWP
COMException ' occurred in SYSTEM.NI.DLL. Additional information: The application called an interface that was marshalled for a different thread.
Read more >
The application called an interface that was marshalled for ...
UWP.Helpers.StiFontHelper' threw an exception.' Exception: The application called an interface that was marshalled for a different thread.
Read more >
UWP - UI Thread and Multiple Views - Code4Noobz
In UWP, your “main” application can open a new – separated – view. ... “The application called an interface that was marshalled for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found