You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 15, 2024. It is now read-only.
This issue is related to the functionality introduced in PR 744.
Using the screenshot API with the UWP sample, provided in the Xamarin Essentials repository, fails with a system exception, related to cross thread access (0x8001010E (RPC_E_WRONG_THREAD).
This only happened to me in UWP. I've tried the Android and iOS implementations and the result was successful.
Steps to Reproduce
Run Xamarin Essentials sample app for UWP
Go to Screenshot -> Take Screenshot
Expected Behavior
Screenshot taken and shown in the app
Actual Behavior
Exception is thrown: System.Exception: 'The application called an interface that was marshalled for a different thread. (Exception from HRESULT: 0x8001010E (RPC_E_WRONG_THREAD))'
Basic Information
Version with issue: Main branch from current code repository (after tag 1.6.0-pre2)
Last known good version:
IDE: Visual Studio 2019 (16.7.5)
Platform Target Frameworks:
UWP: 16299
Affected Devices: Windows 10 Pro 2004
Screenshots
Aditional Info
I tracked down the exception source to the Screenshot UWP implementation line 39, when trying to access the bmp.PixelWidth. The problem is that the caller of the ScreenshotResult constructor is passing a object instance that was created in a different thread, since we have a ConfigureAwait(false) on line 24.
A quick solution could be setting it to ConfigureAwait(true) or removing the instruction all together.
Once this issue is confirmed as valid, I can make the PR myself.
Description
This issue is related to the functionality introduced in PR 744.
Using the screenshot API with the UWP sample, provided in the Xamarin Essentials repository, fails with a system exception, related to cross thread access (0x8001010E (RPC_E_WRONG_THREAD).
This only happened to me in UWP. I've tried the Android and iOS implementations and the result was successful.
Steps to Reproduce
Expected Behavior
Screenshot taken and shown in the app
Actual Behavior
Exception is thrown:
System.Exception: 'The application called an interface that was marshalled for a different thread. (Exception from HRESULT: 0x8001010E (RPC_E_WRONG_THREAD))'Basic Information
Screenshots
Aditional Info
I tracked down the exception source to the Screenshot UWP implementation line 39, when trying to access the
bmp.PixelWidth. The problem is that the caller of theScreenshotResultconstructor is passing a object instance that was created in a different thread, since we have aConfigureAwait(false)on line 24.A quick solution could be setting it to
ConfigureAwait(true)or removing the instruction all together.Once this issue is confirmed as valid, I can make the PR myself.