Skip to content

Fix the FilePicker.PickMultipleAsync() Not Returning Null When Canceled #27961

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
Mar 21, 2025

Conversation

devanathan-vaithiyanathan
Copy link
Contributor

@devanathan-vaithiyanathan devanathan-vaithiyanathan commented Feb 21, 2025

Issue Details

If the user cancels the file picking, the result must be null. However, FilePicker.PickMultipleAsync() does not return a null value.

Root Cause

The method currently returns a file result value even when the user cancels the file pick operation.

Description of Change

Modify the FilePicker.PickMultipleAsync() method to be nullable and return null when the user cancels the file pick operation.

Validated the behavior in the following platforms

  • Android
  • Windows
  • iOS
  • Mac

Issues Fixed

Fixes #27710

Output ScreenShot

Before After
BeforeFix.mov
AfterFix.1.mov

@dotnet-policy-service dotnet-policy-service bot added community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration labels Feb 21, 2025
@sheiksyedm sheiksyedm added the area-essentials Essentials: Device, Display, Connectivity, Secure Storage, Sensors, App Info label Feb 24, 2025
@devanathan-vaithiyanathan devanathan-vaithiyanathan marked this pull request as ready for review February 24, 2025 12:41
@Copilot Copilot AI review requested due to automatic review settings February 24, 2025 12:42
@devanathan-vaithiyanathan devanathan-vaithiyanathan requested a review from a team as a code owner February 24, 2025 12:42
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.

Copilot reviewed 3 out of 10 changed files in this pull request and generated 3 comments.

Files not reviewed (7)
  • src/Essentials/src/PublicAPI/net-android/PublicAPI.Shipped.txt: Language not supported
  • src/Essentials/src/PublicAPI/net-ios/PublicAPI.Shipped.txt: Language not supported
  • src/Essentials/src/PublicAPI/net-maccatalyst/PublicAPI.Shipped.txt: Language not supported
  • src/Essentials/src/PublicAPI/net-tizen/PublicAPI.Shipped.txt: Language not supported
  • src/Essentials/src/PublicAPI/net-windows/PublicAPI.Shipped.txt: Language not supported
  • src/Essentials/src/PublicAPI/net/PublicAPI.Shipped.txt: Language not supported
  • src/Essentials/src/PublicAPI/netstandard/PublicAPI.Shipped.txt: Language not supported
Comments suppressed due to low confidence (1)

src/Essentials/src/FilePicker/FilePicker.uwp.cs:43

  • Ensure that there is a test case that covers the scenario where resultList.Count == 0 and the method returns null.
return resultList.Count == 0 ? null : resultList.Select(storageFile => new FileResult(storageFile));

@dotnet dotnet deleted a comment from azure-pipelines bot Mar 11, 2025
@dotnet dotnet deleted a comment from jsuarezruiz Mar 11, 2025
@dotnet dotnet deleted a comment from azure-pipelines bot Mar 11, 2025
@rmarinho
Copy link
Member

/rebase

@dotnet dotnet deleted a comment from azure-pipelines bot Mar 20, 2025
@rmarinho
Copy link
Member

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

Copy link
Contributor

🚨 API change(s) detected @davidbritch FYI

@rmarinho rmarinho merged commit 8c7c7ec into dotnet:net10.0 Mar 21, 2025
126 of 128 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Apr 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-essentials Essentials: Device, Display, Connectivity, Secure Storage, Sensors, App Info community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration t/breaking 💥
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants