Skip to content

Conversation

@bhavanesh2001
Copy link
Contributor

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Description of Change

Follow up to (#29498)

This PR ensures FilePicker.PickAsync completes correctly when the user dismisses the file picker by swiping down on iOS older versions , where WasCancelled is not reliably triggered. ( I can reproduce this on iOS15.5).

Somehow in older iOS versions dismissing the UIDocumentPickerViewController via swipe-down gesture does not invoke the WasCancelled event. As a result, the TaskCompletionSource is never completed, causing PickAsync to hang.

Fix

UIPresentationController.Delegate was already used in the legacy delegate-based file picker path.
This PR extends that logic to also apply to the modern event-based picker API (DidPickDocumentAtUrls, WasCancelled), ensuring consistent cancellation handling across all code paths.

Issues Fixed

Fixes #30282

@bhavanesh2001 bhavanesh2001 requested a review from a team as a code owner June 27, 2025 20:30
@dotnet-policy-service
Copy link
Contributor

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

@jfversluis jfversluis added this to the .NET 9 SR9 milestone Jun 29, 2025
@PureWeen PureWeen changed the base branch from main to inflight/current June 29, 2025 22:49
@PureWeen PureWeen merged commit 1b4212f into dotnet:inflight/current Jun 29, 2025
1 check passed
github-actions bot pushed a commit that referenced this pull request Jun 29, 2025
github-actions bot pushed a commit that referenced this pull request Jul 1, 2025
github-actions bot pushed a commit that referenced this pull request Jul 2, 2025
github-actions bot pushed a commit that referenced this pull request Jul 2, 2025
github-actions bot pushed a commit that referenced this pull request Jul 8, 2025
github-actions bot pushed a commit that referenced this pull request Jul 8, 2025
github-actions bot pushed a commit that referenced this pull request Jul 9, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Jul 30, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FilePicker.PickAsync Task Hangs When User Swipes Down to Cancel the Picker

3 participants