FFImageLoading: [UWP] Unhandled Exception: The application called an interface that was marshalled for a different thread.
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()```
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 37 (29 by maintainers)
Commits related to this issue
- Modified initial image loading task TaskCreationOptions, I hope it'll finally solve #439 — committed to luberda-molinet/FFImageLoading by daniel-luberda 7 years ago
- #439 — committed to luberda-molinet/FFImageLoading by daniel-luberda 7 years ago
- Fix of [UWP] Unhandled Exception: The application called an interface that was marshalled for a different thread. https://github.com/luberda-molinet/FFImageLoading/issues/439#issuecomment-318780304 — committed to alexkrafts/FFImageLoading by alexkrafts 7 years ago
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.
I’m going to test it between today and tomorrow… I’ll back to you really soon. Thanks!
It’s the correct version, it was moved here: https://github.com/luberda-molinet/FFImageLoading/blob/master/source/FFImageLoading.Windows/Cache/FFSourceBindingCache.cs 😃