WinPhone: Exception on StreamImagesourceHandler LoadImageAsync

In one of my Dependency Services on WinPhone I'm trying to convert a StreamImageSource to an image using the StreamImagesourceHandler.
I'm stuck as it results in an exception.
When I run the following code:
IImageSourceHandler imgSourceHandler = new StreamImagesourceHandler(); var img = await imgSourceHandler.LoadImageAsync(source);
This will result in the following exception:
Read is not supported on the main thread when buffering is disabled.
Stacktrace:
at MS.Internal.InternalNetworkStream.Read(Byte[] buffer, Int32 offset, Int32 count) at System.Net.Http.HttpClientHandler.WebExceptionWrapperStream.Read(Byte[] buffer, Int32 offset, Int32 count) at System.Net.Http.DelegatingStream.Read(Byte[] buffer, Int32 offset, Int32 count) at System.Windows.Media.Imaging.BitmapSource.SetSourceInternal(Stream streamSource) at System.Windows.Media.Imaging.BitmapImage.SetSourceInternal(Stream streamSource) at Xamarin.Forms.Platform.WinPhone.StreamImagesourceHandler.<LoadImageAsync>d__0.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.TaskAwaiter1.GetResult()
at ***.WinPhone.DependencyServices.Picture_WinPhone.d__2.MoveNext()`

I'm I doing something wrong or is this a bug?
I'm not having that much experience with WinPhone. This same method is working fine on iOS and Android.

Answers

  • TheosTheos NLBeta ✭✭

    Sorry to bump this.
    Anyone with some kind of suggestion or something?

    Thanks!

Sign In or Register to comment.