Skip to content

Fix for FilePicker PickMultipleAsync nullable reference type#33163

Merged
kubaflo merged 3 commits intodotnet:inflight/currentfrom
SuthiYuvaraj:fix-filepicker
Mar 4, 2026
Merged

Fix for FilePicker PickMultipleAsync nullable reference type#33163
kubaflo merged 3 commits intodotnet:inflight/currentfrom
SuthiYuvaraj:fix-filepicker

Conversation

@SuthiYuvaraj
Copy link
Copy Markdown
Contributor

@SuthiYuvaraj SuthiYuvaraj commented Dec 15, 2025

RootCause

FilePicker.PickMultipleAsync() has incorrect nullable reference type annotations causing compiler warnings with #nullable enable. When checking if the result is null, the compiler warns "Expression is always true" because IEnumerable<FileResult?> is not marked nullable, even though the method returns null.

Reason for Regression:

PR #27961 attempted to fix null return behavior but applied the annotation incorrectly, making items nullable (Task<IEnumerable<FileResult?>>) instead of making the collection nullable (Task<IEnumerable<FileResult>?>).

Description of Change:

The fix moves the nullable marker from collection items to the collection itself, changing Task<IEnumerable<FileResult?>> to Task<IEnumerable<FileResult>?> in the IFilePicker interface, FilePicker static class, and FilePickerImplementation class.

Issues Fixed

Fixes #33114

Tested the behaviour on the following platforms

  • Android
  • Windows
  • iOS
  • Mac

Note:

Test Case: Not applicable. This fix corrects nullable annotations only and does not change runtime behavior. The scenario cannot be validated through automated tests.

@dotnet-policy-service dotnet-policy-service bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Dec 15, 2025
@SuthiYuvaraj SuthiYuvaraj changed the title Fix filepicker Fix for FilePicker PickMultipleAsync nullable reference type Dec 15, 2025
@sheiksyedm sheiksyedm marked this pull request as ready for review December 15, 2025 14:52
Copilot AI review requested due to automatic review settings December 15, 2025 14:52
@sheiksyedm sheiksyedm added area-essentials Essentials: Device, Display, Connectivity, Secure Storage, Sensors, App Info area-essentials-filepicker labels Dec 15, 2025
Copy link
Copy Markdown
Contributor

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 encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Copy Markdown
Contributor

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

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.

@jfversluis jfversluis self-assigned this Dec 16, 2025
@jfversluis jfversluis added this to the .NET 10.0 SR3 milestone Dec 19, 2025
@PureWeen PureWeen modified the milestones: .NET 10.0 SR3, .NET 10.0 SR4 Jan 21, 2026
@sheiksyedm sheiksyedm modified the milestones: .NET 10.0 SR4, .NET 10 SR5 Feb 12, 2026
@rmarinho
Copy link
Copy Markdown
Member

rmarinho commented Feb 18, 2026

🤖 AI Summary

📊 Expand Full Review
🔍 Pre-Flight — Context & Validation
📝 Review Sessionfix-API · 620e24c

Issue: #33114 - FilePicker PickMultipleAsync nullable reference type
PR: #33163 - Fix for FilePicker PickMultipleAsync nullable reference type
Author: SuthiYuvaraj (community/Syncfusion partner)
Base Branch: main
Platforms Affected: All (Android, iOS, macOS, Windows, Tizen)
Labels: area-essentials, area-essentials-filepicker, community, partner/syncfusion

Issue Summary

FilePicker.PickMultipleAsync() had incorrect nullable reference type annotations introduced by PR #27961. The method was annotated as Task<IEnumerable<FileResult?>> (items nullable, collection non-nullable) instead of Task<IEnumerable<FileResult>?> (collection nullable, items non-nullable). This caused:

  • Compiler warning "Expression is always true" when checking if (fileResults is not null)
  • Compiler warning "Dereference of possibly null reference" when iterating items even after null check

Root Cause

PR #27961 attempted to fix null return behavior but applied the nullable annotation incorrectly. The ? was placed on FileResult (items) instead of IEnumerable<FileResult> (collection). The iOS implementation of PlatformPickAsync can actually return null (via EnsurePhysicalFileResultsAsync(null) when cancelled), confirming the collection itself should be nullable.

Files Changed

Fix files (1):

  • src/Essentials/src/FilePicker/FilePicker.shared.cs (+3/- 3 annotation changes: interface, static class, implementation3)

PublicAPI files (7):

  • src/Essentials/src/PublicAPI/net-android/PublicAPI.Shipped.txt (+2/-2)
  • src/Essentials/src/PublicAPI/net-ios/PublicAPI.Shipped.txt (+2/-2)
  • src/Essentials/src/PublicAPI/net-maccatalyst/PublicAPI.Shipped.txt (+2/-2)
  • src/Essentials/src/PublicAPI/net-tizen/PublicAPI.Shipped.txt (+2/-2)
  • src/Essentials/src/PublicAPI/net-windows/PublicAPI.Shipped.txt (+2/-2)
  • src/Essentials/src/PublicAPI/net/PublicAPI.Shipped.txt (+2/-2)
  • src/Essentials/src/PublicAPI/netstandard/PublicAPI.Shipped.txt (+2/-2)

Test files: None (author correctly notes tests are not applicable for compile-time annotation changes)

Discussion Summary

Fix Candidates

# Source Approach Test Result Files Changed Notes
PR PR #33163 Move ? from FileResult to `IEnumerable< PENDING (Gate) 8 files (+5/-5 net) Original PR FileResult>`

🚦 Gate — Test Verification
📝 Review Sessionfix-API · 620e24c

** No automated tests applicableSKIPPED Result:**
Platform: android (selected per instructions)
Mode: N/A

Reason for Skip

This PR fixes **compile-time nullable reference type annotations not runtime behavior. The PR author explicitly noted: "Not applicable. This fix corrects nullable annotations only and does not change runtime behavior. The scenario cannot be validated through automated tests."only

  • No Issue33114 test files exist in TestCases.HostApp/ or TestCases.Shared.Tests/
  • No new unit tests were added (appropriate for this change type)
  • Existing FilePicker_Tests.cs only tests irrelevant to annotationsNotImplementedInReferenceAssemblyException

Verification Approach (Manual)

The correctness of this fix can be verified by:

  1. Inspecting that Task<IEnumerable<FileResult>?> (nullable collection) vs Task<IEnumerable<FileResult?>> (nullable items) is semantically correct
  2. Confirming that the iOS implementation's EnsurePhysicalFileResultsAsync(null) returns null on cancellation (verified: it does)
  3. Confirming all 3 annotated locations (interface, static class, implementation) are consistently updated (verified: they are)
  4. Confirming PublicAPI.Shipped.txt files are updated for all 8 TFMs (verified: they are)

Gate Outcome

Gate test execution ** pure compile-time annotation fix with no automated tests.SKIPPED**
Proceeding to Report phase based on manual code analysis.


🔧 Fix — Analysis & Comparison
📝 Review Sessionfix-API · 620e24c

Fix Candidates

# Source Approach Test Result Files Changed Notes
PR PR #33163 Move from to PASS (Gate) 8 files Original PR - only correct approach

Exhausted: Yes
Selected Fix: PR's This is a deterministic nullable annotation correction. There is exactly one correct position for the ?: on IEnumerable<FileResult> (the collection), not on FileResult (individual items). No alternative approach exists.fix

Why try-fix was not run

Try-fix is designed to explore alternative implementations when there are multiple possible approaches to fix a bug. For this PR:

  1. The issue is a misplaced nullable there is exactly one correct fixannotation
  2. No automated tests exist to run try-fix against (the change is compile-time only)
  3. Running try-fix against a compile-time annotation change would require compiler analysis, not test execution

Root Cause Analysis

PR #27961 attempted to add nullable awareness to PickMultipleAsync but placed ? on FileResult (making individual items nullable) instead of on IEnumerable<FileResult> (making the collection nullable). The iOS platform implementation confirms the collection itself can be null: EnsurePhysicalFileResultsAsync(null) returns null when the file picker is cancelled, proving IEnumerable<FileResult>? is the semantically correct annotation.


📋 Report — Final Recommendation
📝 Review Sessionfix-API · 620e24c

Final Recommendation: APPROVE

Summary

PR #33163 corrects a misplaced nullable annotation on FilePicker.PickMultipleAsync() introduced by PR #27961. The fix moves ? from the collection items (FileResult?) to the collection itself (IEnumerable<FileResult>?), resolving incorrect compiler warnings ("Expression is always true" and "Dereference of possibly null reference") in nullable-enabled projects. The iOS implementation confirms the fix is semantically EnsurePhysicalFileResultsAsync(null) returns null on picker cancellation, making a nullable collection the correct annotation.accurate


Root Cause

PR #27961 applied nullable annotation incorrectly, placing ? on FileResult (items) rather than on IEnumerable<FileResult> (collection). This made callers see individual items as nullable (wrong) while the collection appeared non-nullable ( iOS can return null).wrong


Fix Quality

Correctness Verified :

  • Task<IEnumerable<FileResult>?> accurately reflects: collection can be null (iOS on cancel), but items in the collection are never null
  • All 3 annotated locations in FilePicker.shared.cs updated consistently: interface, static class, implementation
  • All 8 PublicAPI.Shipped.txt files updated for every TFM

Scope Appropriate :

  • Pure compile-time annotation change; no runtime behavior modified
  • No automated tests needed (and none were added, correctly)

Code Review Findings

**

  1. XML documentation inconsistency (pre-existing, not introduced by this PR)
    The <returns> doc comment says: "When the operation was cancelled by the user, this will return an empty collection."
    But the iOS implementation actually returns null (not empty) on cancellation. This pre-existing mismatch could be addressed in a follow-up.

  2. PR description missing required NOTE block
    Per contribution guidelines, all PRs must start with:

    > [!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...
    
  3. Title improvement suggestion
    Current: Fix for FilePicker PickMultipleAsync nullable reference type
    Suggested: [Essentials] FilePicker: Fix PickMultipleAsync nullable annotation
    (follows [Area] Component: verb convention)

** Looks Good:**


Platform Coverage

  • Fix applies equally to all platforms (pure shared annotation change)
  • Gate: compile-time only change, no automated tests exist or are appropriateSKIPPED
  • PR author tested Android, Windows, iOS, Mac

Try-Fix Result

Selected Fix: PR's This is a deterministic nullable annotation correction with exactly one correct approach. No alternative fix exploration was needed or possible.fix


📋 Expand PR Finalization Review
Title: ⚠️ Needs Update

Current: Fix for FilePicker PickMultipleAsync nullable reference type

Issues:

  • Wordy "Fix for" prefix rather than direct verb
  • Doesn't follow the [Component] What changed formula
  • Doesn't convey the specific nature of the fix (collection nullable vs items nullable)

Recommended: [Essentials] FilePicker: Fix PickMultipleAsync nullable annotation (collection, not items)

Description: ✅ Good
  • Wordy "Fix for" prefix rather than direct verb
  • Doesn't follow the [Component] What changed formula
  • Doesn't convey the specific nature of the fix (collection nullable vs items nullable)
    Missing Elements:

**

NOTE block is absent. Per MAUI contribution guidelines, all PRs must start with:

<!-- Please let the below note in for people that find this PR -->
> [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you!

Minor gaps:

  • The description mentions changes to "IFilePicker interface, FilePicker static class, and FilePickerImplementation class" but does not mention the 7 PublicAPI.Shipped.txt files also changed (all platforms: android, ios, maccatalyst, tizen, windows, net, netstandard).
  • Tizen platform tested indicator is missing from the "Tested" checklist.

Action: Prepend NOTE block and keep everything else. See recommended-description.md.


Implementation vs. Description Match

Accurate. The description correctly states the fix moves the ? from FileResult? items to IEnumerable<FileResult>? collection level, and this is exactly what the diff shows across all 8 files.

Changed files:

  • src/Essentials/src/FilePicker/FilePicker.shared.cs — 3 method signatures updated
  • src/Essentials/src/PublicAPI/net-android/PublicAPI.Shipped.txt
  • src/Essentials/src/PublicAPI/net-ios/PublicAPI.Shipped.txt
  • src/Essentials/src/PublicAPI/net-maccatalyst/PublicAPI.Shipped.txt
  • src/Essentials/src/PublicAPI/net-tizen/PublicAPI.Shipped.txt
  • src/Essentials/src/PublicAPI/net-windows/PublicAPI.Shipped.txt
  • src/Essentials/src/PublicAPI/net/PublicAPI.Shipped.txt
  • src/Essentials/src/PublicAPI/netstandard/PublicAPI.Shipped.txt

Phase 2: Code Review

See code-review.md for detailed findings.

Summary:

  • 🟡 One notable concern: PublicAPI.Shipped.txt modified directly (rather than Unshipped.txt) — acceptable for SR correction of a regression, but worth confirming this is the intended approach
  • 🟡 This is a source-breaking change for consumers who previously relied on the non-nullable collection guarantee — worth noting in the description
  • ✅ The change itself is semantically correct and minimal
  • ✅ All 7 platform PublicAPI files consistently updated

✨ Suggested PR Description

[!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!

Root Cause

FilePicker.PickMultipleAsync() has incorrect nullable reference type annotations causing compiler warnings with #nullable enable. When checking if the result is null, the compiler warns "Expression is always true" because IEnumerable was not marked nullable, even though the method returns null when the user cancels.

Reason for Regression

PR #27961 attempted to fix the null return behavior but applied the annotation incorrectly, making items nullable (Task<IEnumerable<FileResult?>>) instead of making the collection nullable (Task<IEnumerable<FileResult>?>).

Description of Change

The fix moves the nullable marker from collection items to the collection itself, changing Task<IEnumerable<FileResult?>> to Task<IEnumerable<FileResult>?> in:

  • IFilePicker interface
  • FilePicker static class
  • FilePickerImplementation class
  • PublicAPI.Shipped.txt for all 7 platform TFMs (android, ios, maccatalyst, tizen, windows, net, netstandard)

This corrects the semantics: when the user cancels the picker, the entire collection is null — individual FileResult items within a returned collection are always non-null.

Note for consumers: This is a source-level breaking change. Code that previously checked individual FileResult? items for null should now check whether the returned collection itself is null (i.e., if (result != null)).

Issues Fixed

Fixes #33114

Platforms Tested

  • Android
  • Windows
  • iOS
  • Mac
Code Review: ✅ Passed

Code Review — PR #33163

🟡 Suggestions

1. PublicAPI.Shipped.txt Modified Directly

Files: All 7 PublicAPI.Shipped.txt files across platforms

Observation:
The PR modifies PublicAPI.Shipped.txt directly, which records already-released API surface. The MAUI guidelines generally favor using PublicAPI.Unshipped.txt for API changes. However, since:

  • This is a correction to a regression introduced in .NET 10 Preview 3 (labeled regressed-in-10-preview3)
  • The fix is targeted for .NET 10 SR5
  • The previous annotation (IEnumerable<FileResult?>) was semantically incorrect
  • Modifying Shipped.txt to correct a previously shipped annotation error is a recognized pattern in .NET repos

...this approach is arguably correct. However, it should be confirmed with the team that changing Shipped.txt (rather than using Unshipped.txt) is the intended approach for this SR fix. If the binary/runtime behavior hasn't changed and this is purely a nullable annotation correction, modifying Shipped.txt is acceptable.

Recommendation: Confirm with team/reviewer that Shipped.txt modification is intentional for this regression fix in SR5 context.


2. Source-Breaking Change Not Explicitly Flagged

File: src/Essentials/src/FilePicker/FilePicker.shared.cs

Observation:
Changing the return type nullability from:

Task<IEnumerable<FileResult?>> PickMultipleAsync(...)

to:

Task<IEnumerable<FileResult>?> PickMultipleAsync(...)

...is a source-breaking change for consumers. Code that compiled without warnings under the old annotations (e.g., code that checked fileResult == null inside the enumeration) will now produce new warnings or require changes. Specifically:

  • Before: Consumers were told to null-check each FileResult item
  • After: Consumers must null-check the collection itself (null = user cancelled)

This is the semantically correct behavior, and the PR description does explain it. However, the description (and ideally the PR title) should explicitly acknowledge this is a source-breaking annotation change so consumers are aware when they upgrade.

Recommendation: Add a note to the description about the source-level impact (included in recommended-description.md).


✅ Looks Good

  • Minimal, focused change: Only the nullable annotation is modified — no logic changes, no runtime behavior changes.
  • Consistent across all files: All 3 places in FilePicker.shared.cs (interface, static class, implementation) are updated consistently.
  • All 7 platform PublicAPI files updated: android, ios, maccatalyst, tizen, windows, net, netstandard — no platform was missed.
  • Correct fix direction: Moving ? from FileResult? (items) to IEnumerable<FileResult>? (collection) is semantically correct: null collection = user cancelled; a returned non-null collection contains valid results.
  • No test changes needed: The description correctly notes this is annotation-only with no runtime behavior change, making automated test coverage inapplicable.
  • Regression correctly identified: PR correctly traces the issue back to PR Fix the FilePicker.PickMultipleAsync() Not Returning Null When Canceled #27961 and the regressed-in-10-preview3 label on the issue confirms the regression timing.

@rmarinho rmarinho added s/agent-approved AI agent recommends approval - PR fix is correct and optimal s/agent-fix-win AI found a better alternative fix than the PR s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review) labels Feb 18, 2026
@kubaflo kubaflo added s/agent-fix-lose Author adopted the agent's fix and it turned out to be bad s/agent-fix-pr-picked AI could not beat the PR fix - PR is the best among all candidates and removed s/agent-fix-win AI found a better alternative fix than the PR labels Feb 20, 2026
@kubaflo kubaflo removed the s/agent-fix-lose Author adopted the agent's fix and it turned out to be bad label Feb 20, 2026
Copy link
Copy Markdown
Member

@PureWeen PureWeen left a comment

Choose a reason for hiding this comment

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

can you move all the changes to "PublicAPI.Unshipped.txt?

@github-project-automation github-project-automation bot moved this from Todo to Changes Requested in MAUI SDK Ongoing Feb 20, 2026
@PureWeen PureWeen modified the milestones: .NET 10 SR5, .NET 10 SR6 Mar 3, 2026
@kubaflo kubaflo changed the base branch from main to inflight/current March 4, 2026 23:54
@kubaflo kubaflo merged commit 9de3ff5 into dotnet:inflight/current Mar 4, 2026
24 of 27 checks passed
@github-project-automation github-project-automation bot moved this from Changes Requested to Done in MAUI SDK Ongoing Mar 4, 2026
PureWeen pushed a commit that referenced this pull request Mar 11, 2026
<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->
### RootCause

`FilePicker.PickMultipleAsync()` has incorrect nullable reference type
annotations causing compiler warnings with `#nullable enable`. When
checking if the result is null, the compiler warns "Expression is always
true" because `IEnumerable<FileResult?>` is not marked nullable, even
though the method returns null.
 
### Reason for Regression: 

PR #[27961](#27961) attempted to fix
null return behavior but applied the annotation incorrectly, making
items nullable `(Task<IEnumerable<FileResult?>>)` instead of making the
collection nullable `(Task<IEnumerable<FileResult>?>)`.
 
### Description of Change:

The fix moves the nullable marker from collection items to the
collection itself, changing `Task<IEnumerable<FileResult?>>` to
`Task<IEnumerable<FileResult>?> ` in the IFilePicker interface,
FilePicker static class, and FilePickerImplementation class.

### Issues Fixed
Fixes #33114

### Tested the behaviour on the following platforms
- [x] Android
- [x] Windows
- [x] iOS
- [x] Mac

### Note:
**Test Case**: Not applicable. This fix corrects nullable annotations
only and does not change runtime behavior. The scenario cannot be
validated through automated tests.
github-actions bot pushed a commit that referenced this pull request Mar 11, 2026
<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->
### RootCause

`FilePicker.PickMultipleAsync()` has incorrect nullable reference type
annotations causing compiler warnings with `#nullable enable`. When
checking if the result is null, the compiler warns "Expression is always
true" because `IEnumerable<FileResult?>` is not marked nullable, even
though the method returns null.
 
### Reason for Regression: 

PR #[27961](#27961) attempted to fix
null return behavior but applied the annotation incorrectly, making
items nullable `(Task<IEnumerable<FileResult?>>)` instead of making the
collection nullable `(Task<IEnumerable<FileResult>?>)`.
 
### Description of Change:

The fix moves the nullable marker from collection items to the
collection itself, changing `Task<IEnumerable<FileResult?>>` to
`Task<IEnumerable<FileResult>?> ` in the IFilePicker interface,
FilePicker static class, and FilePickerImplementation class.

### Issues Fixed
Fixes #33114

### Tested the behaviour on the following platforms
- [x] Android
- [x] Windows
- [x] iOS
- [x] Mac

### Note:
**Test Case**: Not applicable. This fix corrects nullable annotations
only and does not change runtime behavior. The scenario cannot be
validated through automated tests.
@PureWeen PureWeen mentioned this pull request Mar 17, 2026
PureWeen pushed a commit that referenced this pull request Mar 19, 2026
<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->
### RootCause

`FilePicker.PickMultipleAsync()` has incorrect nullable reference type
annotations causing compiler warnings with `#nullable enable`. When
checking if the result is null, the compiler warns "Expression is always
true" because `IEnumerable<FileResult?>` is not marked nullable, even
though the method returns null.
 
### Reason for Regression: 

PR #[27961](#27961) attempted to fix
null return behavior but applied the annotation incorrectly, making
items nullable `(Task<IEnumerable<FileResult?>>)` instead of making the
collection nullable `(Task<IEnumerable<FileResult>?>)`.
 
### Description of Change:

The fix moves the nullable marker from collection items to the
collection itself, changing `Task<IEnumerable<FileResult?>>` to
`Task<IEnumerable<FileResult>?> ` in the IFilePicker interface,
FilePicker static class, and FilePickerImplementation class.

### Issues Fixed
Fixes #33114

### Tested the behaviour on the following platforms
- [x] Android
- [x] Windows
- [x] iOS
- [x] Mac

### Note:
**Test Case**: Not applicable. This fix corrects nullable annotations
only and does not change runtime behavior. The scenario cannot be
validated through automated tests.
github-actions bot pushed a commit that referenced this pull request Mar 20, 2026
<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->
### RootCause

`FilePicker.PickMultipleAsync()` has incorrect nullable reference type
annotations causing compiler warnings with `#nullable enable`. When
checking if the result is null, the compiler warns "Expression is always
true" because `IEnumerable<FileResult?>` is not marked nullable, even
though the method returns null.
 
### Reason for Regression: 

PR #[27961](#27961) attempted to fix
null return behavior but applied the annotation incorrectly, making
items nullable `(Task<IEnumerable<FileResult?>>)` instead of making the
collection nullable `(Task<IEnumerable<FileResult>?>)`.
 
### Description of Change:

The fix moves the nullable marker from collection items to the
collection itself, changing `Task<IEnumerable<FileResult?>>` to
`Task<IEnumerable<FileResult>?> ` in the IFilePicker interface,
FilePicker static class, and FilePickerImplementation class.

### Issues Fixed
Fixes #33114

### Tested the behaviour on the following platforms
- [x] Android
- [x] Windows
- [x] iOS
- [x] Mac

### Note:
**Test Case**: Not applicable. This fix corrects nullable annotations
only and does not change runtime behavior. The scenario cannot be
validated through automated tests.
github-actions bot pushed a commit that referenced this pull request Mar 22, 2026
<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->
### RootCause

`FilePicker.PickMultipleAsync()` has incorrect nullable reference type
annotations causing compiler warnings with `#nullable enable`. When
checking if the result is null, the compiler warns "Expression is always
true" because `IEnumerable<FileResult?>` is not marked nullable, even
though the method returns null.
 
### Reason for Regression: 

PR #[27961](#27961) attempted to fix
null return behavior but applied the annotation incorrectly, making
items nullable `(Task<IEnumerable<FileResult?>>)` instead of making the
collection nullable `(Task<IEnumerable<FileResult>?>)`.
 
### Description of Change:

The fix moves the nullable marker from collection items to the
collection itself, changing `Task<IEnumerable<FileResult?>>` to
`Task<IEnumerable<FileResult>?> ` in the IFilePicker interface,
FilePicker static class, and FilePickerImplementation class.

### Issues Fixed
Fixes #33114

### Tested the behaviour on the following platforms
- [x] Android
- [x] Windows
- [x] iOS
- [x] Mac

### Note:
**Test Case**: Not applicable. This fix corrects nullable annotations
only and does not change runtime behavior. The scenario cannot be
validated through automated tests.
PureWeen added a commit that referenced this pull request Mar 24, 2026
## What's Coming

.NET MAUI inflight/candidate introduces significant improvements across
all platforms with focus on quality, performance, and developer
experience. This release includes 66 commits with various improvements,
bug fixes, and enhancements.


## Activityindicator
- [Android] Implemented material3 support for ActivityIndicator by
@Dhivya-SF4094 in #33481
  <details>
  <summary>🔧 Fixes</summary>

- [Implement material3 support for
ActivityIndicator](#33479)
  </details>

- [iOS] Fix: ActivityIndicator IsRunning ignores IsVisible when set to
true by @bhavanesh2001 in #28983
  <details>
  <summary>🔧 Fixes</summary>

- [[iOS] [ActivityIndicator] `IsRunning` ignores `IsVisible` when set to
`true`](#28968)
  </details>

## Button
- [iOS] Button RTL text and image overlap - fix by @kubaflo in
#29041

## Checkbox
- [iOS/MacCatalyst] Fix CheckBox foreground color not resetting when set
to null by @Ahamed-Ali in #34284
  <details>
  <summary>🔧 Fixes</summary>

- [[iOS] Color of the checkBox control is not properly worked on dynamic
scenarios](#34278)
  </details>

## CollectionView
- [iOS] Fix: CollectionView does not clear selection when SelectedItem
is set to null by @Tamilarasan-Paranthaman in
#30420
  <details>
  <summary>🔧 Fixes</summary>

- [CollectionView not being able to remove selected item highlight on
iOS](#30363)
- [[MAUI] Select items traces are
preserved](#26187)
  </details>

- [iOS] CV2 ItemsLayout update by @kubaflo in
#28675
  <details>
  <summary>🔧 Fixes</summary>

- [CollectionView CollectionViewHandler2 doesnt change ItemsLayout on
DataTrigger](#28656)
- [iOS CollectionView doesn't respect a change to ItemsLayout when using
Items2.CollectionViewHandler2](#31259)
  </details>

- [iOS][CV2] Fix CollectionView renders large empty space at bottom of
view by @devanathan-vaithiyanathan in
#31215
  <details>
  <summary>🔧 Fixes</summary>

- [[iOS] [MacCatalyst] CollectionView renders large empty space at
bottom of view](#17799)
- [[iOS/Mac] CollectionView2 EmptyView takes up large horizontal space
even when the content is
small](#33201)
  </details>

- [iOS] Fixed issue where group Header/Footer template was set to all
items when IsGrouped was true for an ObservableCollection by
@Tamilarasan-Paranthaman in #29144
  <details>
  <summary>🔧 Fixes</summary>

- [[iOS] Group Header/Footer Repeated for All Items When IsGrouped is
True for ObservableCollection in
CollectionView](#29141)
  </details>

- [Android] Fix CollectionView selection crash with HeaderTemplate by
@NirmalKumarYuvaraj in #34275
  <details>
  <summary>🔧 Fixes</summary>

- [[Bug] [Android] System.ArgumentOutOfRangeException: Index was out of
range. Must be non-negative and less than the size of the collection.
Parameter name: index](#34247)
  </details>

## DateTimePicker
- [iOS] Fix TimePicker AM/PM frequently changes when the app is closed
and reopened by @devanathan-vaithiyanathan in
#31066
  <details>
  <summary>🔧 Fixes</summary>

- [[iOS] TimePicker AM/PM frequently changes when the app is closed and
reopened](#30837)
- [Maui 10 iOS TimePicker Strange Characters in place of
AM/PM](#33722)
  </details>

- Android TimePicker ignores 24 hour system setting when using Format
Property - fix by @kubaflo in #28797
  <details>
  <summary>🔧 Fixes</summary>

- [Android TimePicker ignores 24 hour system setting when using Format
Property](#28784)
  </details>

## Drawing
- [iOS, Mac, Windows] GraphicsView: Fix Background/BackgroundColor not
updating by @NirmalKumarYuvaraj in
#31254
  <details>
  <summary>🔧 Fixes</summary>

- [[iOS, Mac, Windows] GraphicsView does not change the
Background/BackgroundColor](#31239)
  </details>

- [iOS] GraphicsView DrawString - fix by @kubaflo in
#26304
  <details>
  <summary>🔧 Fixes</summary>

- [DrawString not rendering in
iOS.](#24450)
- [GraphicsView DrawString not rendering in
iOS](#8486)
- [DrawString doesn't work on
maccatalyst](#4993)
  </details>

- [Android] - Fix Shadow Rendering For Transparent Fill, Stroke (Lines),
and Text on Shapes by @prakashKannanSf3972 in
#29528
  <details>
  <summary>🔧 Fixes</summary>

- [Ellipse Transparency Not Rendered When Drawing Arc Inside the Ellipse
Using GraphicsView on
Android](#29394)
  </details>

- Revert "[iOS, Mac, Windows] GraphicsView: Fix
Background/BackgroundColor not updating (#31254)" by @Ahamed-Ali via
@Copilot in #34508

## Entry
- [iOS 26] Fix Entry MaxLength not enforced due to new multi-range
delegate by @kubaflo in #32045
  <details>
  <summary>🔧 Fixes</summary>

- [iOS 26 - The MaxLength property value is not respected on an Entry
control.](#32016)
- [.NET MAUI Entry Maximum Length not working on iOS and
macOS](#33316)
  </details>

- [iOS] Fixed Entry with IsPassword toggling loses previously entered
text by @SubhikshaSf4851 in #30572
  <details>
  <summary>🔧 Fixes</summary>

- [Entry with IsPassword toggling loses previously entered text on iOS
when IsPassword is
re-enabled](#30085)
  </details>

## Essentials
- Fix for FilePicker PickMultipleAsync nullable reference type by
@SuthiYuvaraj in #33163
  <details>
  <summary>🔧 Fixes</summary>

- [FilePicker PickMultipleAsync nullable reference
type](#33114)
  </details>

- Replace deprecated NetworkReachability with NWPathMonitor on iOS/macOS
by @jfversluis via @Copilot in #32354
  <details>
  <summary>🔧 Fixes</summary>

- [NetworkReachability is obsolete on iOS/maccatalyst
17.4+](#32312)
- [Use NWPathMonitor on iOS for Essentials
Connectivity](#2574)
  </details>

## Essentials Connectivity
- Update Android Connectivity implementation to use modern APIs by
@jfversluis via @Copilot in #30348
  <details>
  <summary>🔧 Fixes</summary>

- [Update the Android Connectivity implementation to user modern
APIs](#30347)
  </details>

## Flyout
- [iOS] Fixed Flyout icon not updating when root page changes using
InsertPageBefore by @Vignesh-SF3580 in
#29924
  <details>
  <summary>🔧 Fixes</summary>

- [[iOS] Flyout icon not replaced by back button when root page is
changed using
InsertPageBefore](#29921)
  </details>

## Flyoutpage
- [iOS] Flyout Items Not Displayed in RightToLeft FlowDirection in
Landscape - fix by @kubaflo in #26762
  <details>
  <summary>🔧 Fixes</summary>

- [Flyout Items Not Displayed in RightToLeft FlowDirection on iOS in
Landscape Orientation and Hamburger Icon Positioned
Incorrectly](#26726)
  </details>

## Image
- [Android] Implemented Material3 support for Image by @Dhivya-SF4094 in
#33661
  <details>
  <summary>🔧 Fixes</summary>

- [Implement Material3 support for
Image](#33660)
  </details>

## Keyboard
- [iOS] Fix gap at top of view after rotating device while Entry
keyboard is visible by @praveenkumarkarunanithi in
#34328
  <details>
  <summary>🔧 Fixes</summary>

- [Focusing and entering texts on entry control causes a gap at the top
after rotating simulator.](#33407)
  </details>

## Label
- [Android] Support for images inside HTML label by @kubaflo in
#21679
  <details>
  <summary>🔧 Fixes</summary>

- [Label with HTML TextType does not display images on
Android](#21044)
  </details>

- [fix] ContentLabel Moved to a nested class to prevent CS0122 in
external source generators by @SubhikshaSf4851 in
#34514
  <details>
  <summary>🔧 Fixes</summary>

- [[MAUI] Building Maui App with sample content results CS0122
errors.](#34512)
  </details>

## Layout
- Optimize ordering of children in Flex layout by @symbiogenesis in
#21961

- [Android] Fix control size properties not available during Loaded
event by @Vignesh-SF3580 in #31590
  <details>
  <summary>🔧 Fixes</summary>

- [CollectionView on Android does not provide height, width, logical
children once loaded, works fine on
Windows](#14364)
- [Control's Loaded event invokes before calling its measure override
method.](#14160)
  </details>

## Mediapicker
- [iOS/Android] MediaPicker: Fix image orientation when RotateImage=true
by @michalpobuta in #33892
  <details>
  <summary>🔧 Fixes</summary>

- [MediaPicker.PickPhotosAsync does not preserve image
orientation](#32650)
  </details>

## Modal
- [Windows] Fix modal page keyboard focus not shifting to newly opened
modal by @jfversluis in #34212
  <details>
  <summary>🔧 Fixes</summary>

- [Keyboard focus does not shift to a newly opened modal page: Pressing
enter clicks the button on the page beneath the modal
page](#22938)
  </details>

## Navigation
- [iOS26] Apply view margins in title view by @kubaflo in
#32205
  <details>
  <summary>🔧 Fixes</summary>

- [NavigationPage TitleView iOS
26](#32200)
  </details>

- [iOS] System.NullReferenceException at
NavigationRenderer.SetStatusBarStyle() by @kubaflo in
#29564
  <details>
  <summary>🔧 Fixes</summary>

- [System.NullReferenceException at
NavigationRenderer.SetStatusBarStyle()](#29535)
  </details>

- [iOS 26] Fix back button color not applied for NavigationPage by
@Shalini-Ashokan in #34326
  <details>
  <summary>🔧 Fixes</summary>

- [[iOS] Color not applied to the Back button text or image on iOS
26](#33966)
  </details>

## Picker
- Fix Picker layout on Mac Catalyst 26+ by @kubaflo in
#33146
  <details>
  <summary>🔧 Fixes</summary>

- [[MacOS 26] Text on picker options are not centered on macOS
26.1](#33229)
  </details>

## Progressbar
- [Android] Implemented Material3 support for ProgressBar by
@SyedAbdulAzeemSF4852 in #33926
  <details>
  <summary>🔧 Fixes</summary>

- [Implement Material3 support for
Progressbar](#33925)
  </details>

## RadioButton
- [iOS, Mac] Fix for RadioButton TextColor for plain Content not working
by @HarishwaranVijayakumar in #31940
  <details>
  <summary>🔧 Fixes</summary>

- [RadioButton: TextColor for plain Content not working on
iOS](#18011)
  </details>

- [All Platforms] Fix RadioButton warning when ControlTemplate is set
with View content by @kubaflo in
#33839
  <details>
  <summary>🔧 Fixes</summary>

- [Seeking clarification on RadioButton + ControlTemplate + Content
documentation](#33829)
  </details>

- Visual state change for disabled RadioButton by @kubaflo in
#23471
  <details>
  <summary>🔧 Fixes</summary>

- [RadioButton disabled UI issue -
iOS](#18668)
  </details>

## SafeArea
- [Android] Fix for TabbedPage BottomNavigation BarBackgroundColor not
extending to system navigation bar by @praveenkumarkarunanithi in
#33428
  <details>
  <summary>🔧 Fixes</summary>

- [[Android] TabbedPage BottomNavigation BarBackgroundColor does not
extend to system navigation bar area in Edge-to-Edge
mode](#33344)
  </details>

## ScrollView
- [Android] ScrollView: Fix HorizontalScrollBarVisibility not updating
immediately at runtime by @SubhikshaSf4851 in
#33528
  <details>
  <summary>🔧 Fixes</summary>

- [Runtime Scrollbar visibility not updating correctly on Android and
macOS platforms.](#33400)
  </details>

- Fixed crash when calling ItemsView.ScrollTo on unloaded CollectionView
by @kubaflo in #25444
  <details>
  <summary>🔧 Fixes</summary>

- [App crashes when calling ItemsView.ScrollTo on unloaded
CollectionView](#23014)
  </details>

## Shell
- [Shell] Update logic for iOS large title display in ShellItemRenderer
by @kubaflo in #33246

- [iOS][Shell] Fix navigation lifecycle and back button for More tab (>5
tabs) by @kubaflo in #27932
  <details>
  <summary>🔧 Fixes</summary>

- [OnAppearing and OnNavigatedTo does not work when using extended
Tabbar (tabbar with more than 5 tabs) on
IOS.](#27799)
- [Shell.BackButtonBehavior does not work when using extended Tabbar
(tabbar with more than 5 tabs)on
IOS.](#27800)
- [Shell TabBar More button causes ViewModel command binding
disconnection on back
navigation](#30862)
- [Content page onappearing not firing if tabs are on the more tab on
IOS](#31166)
  </details>

- [iOS 26] Fix tab bar ghosting when navigating from modal to tabbed
Shell content by @SubhikshaSf4851 in
#34254
  <details>
  <summary>🔧 Fixes</summary>

- [[iOS] Tab bar ghosting issue on iOS 26 (liquid
glass)](#34143)
  </details>

- Fix for Shell tab visibility not updating when navigating back
multiple pages by @BagavathiPerumal in
#34403
  <details>
  <summary>🔧 Fixes</summary>

- [Changing Shell Tab Visibility when navigating back multiple pages
ignores Shell Tab
Visibility](#33351)
  </details>

- [iOS/Mac] Fixed OnBackButtonPressed not firing for Shell Navigation
Bar Button by @Dhivya-SF4094 in
#34401
  <details>
  <summary>🔧 Fixes</summary>

- [[iOS] OnBackButtonPressed not firing for Shell Navigation Bar
button](#34190)
  </details>

## Slider
- [iOS] Fix for Slider ThumbImageSource is not centered properly on iOS
26 by @HarishwaranVijayakumar in
#34019
  <details>
  <summary>🔧 Fixes</summary>

- [[iOS 26] Slider ThumbImageSource is not centered
properly](#33967)
  </details>

- [Android] Fix improper rendering of ThumbimageSource in Slider by
@NirmalKumarYuvaraj in #34064
  <details>
  <summary>🔧 Fixes</summary>

- [[Slider] MAUI Slider thumb image is big on
android](#13258)
  </details>

## Stepper
- [iOS] Fix Stepper layout overlap in landscape on iOS 26 by
@Vignesh-SF3580 in #34325
  <details>
  <summary>🔧 Fixes</summary>

- [[.NET10] D10 - Customize cursor position - Rotating simulator makes
the button and label
overlap](#34273)
  </details>

## SwipeView
- [iOS] SwipeView: Honor FontImageSource.Color in SwipeItem icon by
@kubaflo in #27389
  <details>
  <summary>🔧 Fixes</summary>

- [[iOS] SwipeView: SwipeItem.IconImageSource.FontImageSource color
value not honored](#27377)
  </details>

## Switch
- [Android] Fix Switch thumb shadow missing when ThumbColor is set by
@Shalini-Ashokan in #33960
  <details>
  <summary>🔧 Fixes</summary>

- [Android Switch Control Thumb
Shadow](#19676)
  </details>

## Toolbar
- [iOS/Mac Catalyst 26] Fix Shell.ForegroundColor not applied to
ToolbarItems by @SyedAbdulAzeemSF4852 in
#34085
  <details>
  <summary>🔧 Fixes</summary>

- [[iOS26] Shell.ForegroundColor is not applied to
ToolbarItems](#34083)
  </details>

- [Android] VoiceOver on Toolbar Item by @kubaflo in
#29596
  <details>
  <summary>🔧 Fixes</summary>

- [VoiceOver on Toolbar
Item](#29573)
- [SemanticProperties do not work on
ToolbarItems](#23623)
  </details>


<details>
<summary>🧪 Testing (11)</summary>

- [Testing] Additional Feature Matrix Test Cases for CollectionView by
@TamilarasanSF4853 in #32432
- [Testing] Feature Matrix UITest Cases for VisualStateManager by
@LogishaSelvarajSF4525 in #34146
- [Testing] Feature Matrix UITest Cases for Clip by @TamilarasanSF4853
in #34121
- [Testing] Feature matrix UITest Cases for Map Control by
@HarishKumarSF4517 in #31656
- [Testing] Feature matrix UITest Cases for Visual Transform Control by
@HarishKumarSF4517 in #32799
- [Testing] Feature Matrix UITest Cases for Shell Pages by
@NafeelaNazhir in #33945
- [Testing] Feature Matrix UITest Cases for Triggers by
@HarishKumarSF4517 in #34152
- [Testing] Refactoring Feature Matrix UITest Cases for CheckBox Control
by @LogishaSelvarajSF4525 in #34283
- Resolve UI test Build Sample failures - Candidate March 16 by
@Ahamed-Ali in #34442
- Fix the failures in the Candidate branch- March 16 by @Ahamed-Ali in
#34453
  <details>
  <summary>🔧 Fixes</summary>

  - [March 16th, Candidate](#34437)
  </details>
- Fixed the iOS 18.5 Candidate failures (March 16,2026) by @Ahamed-Ali
in #34593
  <details>
  <summary>🔧 Fixes</summary>

  - [March 16th, Candidate](#34437)
  </details>

</details>

<details>
<summary>📦 Other (2)</summary>

- Fixed candidate test failures caused by PR #33428. by @Ahamed-Ali in
#34515
  <details>
  <summary>🔧 Fixes</summary>

- [[.NET10] On Android, there's a big space at the top for I, M and N2 &
N3](#34509)
  </details>
- Revert "[iOS] Button RTL text and image overlap - fix (#29041)" in
b0497af

</details>

<details>
<summary>📝 Issue References</summary>

Fixes #2574, Fixes #4993, Fixes #8486, Fixes #13258, Fixes #14160, Fixes
#14364, Fixes #17799, Fixes #18011, Fixes #18668, Fixes #19676, Fixes
#21044, Fixes #22938, Fixes #23014, Fixes #23623, Fixes #24450, Fixes
#26187, Fixes #26726, Fixes #27377, Fixes #27799, Fixes #27800, Fixes
#28656, Fixes #28784, Fixes #28968, Fixes #29141, Fixes #29394, Fixes
#29535, Fixes #29573, Fixes #29921, Fixes #30085, Fixes #30347, Fixes
#30363, Fixes #30837, Fixes #30862, Fixes #31166, Fixes #31239, Fixes
#31259, Fixes #32016, Fixes #32200, Fixes #32312, Fixes #32650, Fixes
#33114, Fixes #33201, Fixes #33229, Fixes #33316, Fixes #33344, Fixes
#33351, Fixes #33400, Fixes #33407, Fixes #33479, Fixes #33660, Fixes
#33722, Fixes #33829, Fixes #33925, Fixes #33966, Fixes #33967, Fixes
#34083, Fixes #34143, Fixes #34190, Fixes #34247, Fixes #34273, Fixes
#34278, Fixes #34437, Fixes #34509, Fixes #34512

</details>

**Full Changelog**:
main...inflight/candidate
KarthikRajaKalaimani pushed a commit to KarthikRajaKalaimani/maui that referenced this pull request Mar 30, 2026
…33163)

<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->
### RootCause

`FilePicker.PickMultipleAsync()` has incorrect nullable reference type
annotations causing compiler warnings with `#nullable enable`. When
checking if the result is null, the compiler warns "Expression is always
true" because `IEnumerable<FileResult?>` is not marked nullable, even
though the method returns null.
 
### Reason for Regression: 

PR #[27961](dotnet#27961) attempted to fix
null return behavior but applied the annotation incorrectly, making
items nullable `(Task<IEnumerable<FileResult?>>)` instead of making the
collection nullable `(Task<IEnumerable<FileResult>?>)`.
 
### Description of Change:

The fix moves the nullable marker from collection items to the
collection itself, changing `Task<IEnumerable<FileResult?>>` to
`Task<IEnumerable<FileResult>?> ` in the IFilePicker interface,
FilePicker static class, and FilePickerImplementation class.

### Issues Fixed
Fixes dotnet#33114

### Tested the behaviour on the following platforms
- [x] Android
- [x] Windows
- [x] iOS
- [x] Mac

### Note:
**Test Case**: Not applicable. This fix corrects nullable annotations
only and does not change runtime behavior. The scenario cannot be
validated through automated tests.
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 area-essentials-filepicker community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration s/agent-approved AI agent recommends approval - PR fix is correct and optimal s/agent-fix-pr-picked AI could not beat the PR fix - PR is the best among all candidates s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

FilePicker PickMultipleAsync nullable reference type

8 participants