Skip to content

[iOS] Permissions.RequestAsync<Premissions.LocationWhenInUse> is getting main thread warnings - fix #29180

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 26, 2025

Conversation

kubaflo
Copy link
Contributor

@kubaflo kubaflo commented Apr 24, 2025

Issues Fixed

Fixes #29172

@Copilot Copilot AI review requested due to automatic review settings April 24, 2025 20:33
@kubaflo kubaflo requested a review from a team as a code owner April 24, 2025 20:33
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes the main thread warnings in Permissions.RequestAsync for iOS by removing the call to EnsureMainThread() in the tvOS/watchOS/iOS implementation.

  • Removed an explicit main thread check that was causing warnings
  • Proceeds directly to RequestLocationAsync for location authorization requests
Comments suppressed due to low confidence (1)

src/Essentials/src/Permissions/Permissions.ios.tvos.watchos.cs:137

  • Removing EnsureMainThread() resolves the main thread warnings, but please double-check that RequestLocationAsync correctly handles any required main-thread operations to avoid potential issues with UI-related permission requests.
EnsureMainThread();

@kubaflo kubaflo changed the title [iOS] Permissions.RequestAsync is getting main thread warnings [iOS] Permissions.RequestAsync<Premissions.LocationWhenInUse> is getting main thread warnings - fix Apr 24, 2025
@kubaflo kubaflo self-assigned this Apr 24, 2025
@kubaflo kubaflo added platform/ios area-essentials Essentials: Device, Display, Connectivity, Secure Storage, Sensors, App Info labels Apr 24, 2025
@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Apr 24, 2025
Copy link
Contributor

Hey there @@kubaflo! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@rmarinho
Copy link
Member

Do we have an idea why it was there in the first place @mattleibow @jfversluis ?

@rmarinho
Copy link
Member

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@mattleibow
Copy link
Member

I am not sure why tbh, it may have been a defensive thing. We should probably test this tho on older OS versions. Might have been something on older devices because it uses UI.

@jfversluis jfversluis added this to the .NET 9 SR9 milestone Jun 26, 2025
@PureWeen PureWeen changed the base branch from main to inflight/current June 26, 2025 17:36
@PureWeen PureWeen merged commit 4684ea4 into dotnet:inflight/current Jun 26, 2025
123 of 128 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-essentials Essentials: Device, Display, Connectivity, Secure Storage, Sensors, App Info community ✨ Community Contribution platform/ios
Projects
None yet
Development

Successfully merging this pull request may close these issues.

iOS: Permissions.RequestAsync is getting main thread warnings
5 participants