xamarin / Essentials

Xamarin.Essentials is no longer supported. Migrate your apps to .NET MAUI, which includes Maui.Essentials.
https://aka.ms/xamarin-upgrade
Other
1.53k stars 505 forks source link

[Bug] First Geolocation request on MacOS never returns #1780

Open janusw opened 3 years ago

janusw commented 3 years ago

Description

Steps to Reproduce

  1. Run Samples.Mac from the XE repo.
  2. Go to the Geolocation section.
  3. Click Refresh (any of the two buttons).

Expected Behavior

Location info is shown.

Actual Behavior

A waiting symbol appears. Both buttons are disabled. Nothing even happens.

Once I go back to the start page and re-enter the Geolocation section, the buttons are available again, and the second request finishes very quickly.

Basic Information

janusw commented 3 years ago

Since both the Location and the LastKnownLocation requests are affected, I already suspected it might be related to the permissions.

Some quick debugging shows that the call to

await Permissions.EnsureGrantedAsync<Permissions.LocationWhenInUse>();

is the one that never returns.

justinhorner commented 3 years ago

Since both the Location and the LastKnownLocation requests are affected, I already suspected it might be related to the permissions.

Some quick debugging shows that the call to

await Permissions.EnsureGrantedAsync<Permissions.LocationWhenInUse>();

is the one that never returns.

I was able to get around this, via a workaround (although not an ideal solution): https://github.com/jamesmontemagno/PermissionsPlugin/issues/191#issuecomment-780059817