Skip to content

XF sample of how Permissions.CheckStatusAsync fails in UWP

Notifications You must be signed in to change notification settings

WillAutioItrax/PermissionFail2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PermissionFail2

XF sample of how Permissions.CheckStatusAsync fails in UWP

This is a simple repo of what I am getting in my app. I started with a Visual Studio Xamarin Forms master-detail template app out of the box. In the AboutPage.xaml I added a Label and in AboutPage.xaml.cs I added an onAppearing() like this:

    protected override async void OnAppearing()
    {
        base.OnAppearing();
        PermissionStatus status5 = await Permissions.CheckStatusAsync
            <Permissions.LocationWhenInUse>().ConfigureAwait(false);

        TestLabel.Text = "Something";
    }

This code results in an exception: 'The application called an interface that was marshalled for a different thread. (Exception from HRESULT: 0x8001010E (RPC_E_WRONG_THREAD))' at TestLabel.Text = "Something";

If I remove the .ConfigureAwait(false) then it works fine. The reason that I have the ConfigureAwait is because in my app, I get intellisense telling me to add ConfigureAwait. So I did. And I got the crashing.

About

XF sample of how Permissions.CheckStatusAsync fails in UWP

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages