Skip to content

Conversation

@kubaflo
Copy link
Contributor

@kubaflo kubaflo commented Nov 12, 2025

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

I think we should add a null check and a default value on Android - similar to how it’s already handled on iOS.

SelectionLimit = options?.SelectionLimit ?? 1,

Replaces direct access to options.SelectionLimit with a local variable that defaults to 1 if options is null. Updates all relevant checks and method calls to use the new variable, improving null safety and code clarity.

Issues Fixed

Fixes #32535

Replaces direct access to options.SelectionLimit with a local variable that defaults to 1 if options is null. Updates all relevant checks and method calls to use the new variable, improving null safety and code clarity.
@kubaflo kubaflo marked this pull request as ready for review November 12, 2025 23:32
Copilot AI review requested due to automatic review settings November 12, 2025 23:32
@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Nov 12, 2025
@dotnet-policy-service
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.

Copy link
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

This PR improves null safety in the Android MediaPicker implementation by refactoring how SelectionLimit is accessed in the PickMultipleUsingPhotoPicker method. The changes align the Android implementation with the existing iOS pattern, ensuring consistent behavior across platforms when options is null.

Key Changes:

  • Introduced a local selectionLimit variable that safely handles null options with a default value of 1
  • Replaced direct options.SelectionLimit accesses with the null-safe local variable throughout the method

@jfversluis
Copy link
Member

/azp run MAUI-public

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jfversluis
Copy link
Member

/backport to release/10.0.1xx-sr1

@github-actions
Copy link
Contributor

Started backporting to release/10.0.1xx-sr1 (link to workflow run)

@jfversluis jfversluis merged commit 3e0e46d into dotnet:main Nov 14, 2025
18 of 23 checks passed
evgenygunko pushed a commit to evgenygunko/CopyWordsDA that referenced this pull request Nov 26, 2025
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [Microsoft.Maui.Controls](https://github.com/dotnet/maui) | nuget | patch | `10.0.10` -> `10.0.11` |

---

### Release Notes

<details>
<summary>dotnet/maui (Microsoft.Maui.Controls)</summary>

### [`v10.0.11`](https://github.com/dotnet/maui/releases/tag/10.0.11): SR1.1

[Compare Source](dotnet/maui@10.0.10...10.0.11)

##### What's Changed

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

##### .NET MAUI Product Fixes

##### Android

-   Fix content page title clipping on Android API < 30 with window insets compatibility by [@&#8203;Copilot](https://github.com/Copilot) in dotnet/maui#32738

    <details>
    <summary>🔧 Fixes</summary>

    -   [Shell content page title position incorrect/clipped](dotnet/maui#32526)

    </details>

##### Button

-   \[release/10.0.1xx-sr1] Removed Value property coercion in RadioButton by [@&#8203;github-actions](https://github.com/github-actions)\[bot] in dotnet/maui#32604

    <details>
    <summary>🔧 Fixes</summary>

    -   [Removed Value property coercion in RadioButton](dotnet/maui#32489)

    </details>

##### DateTimePicker

-   Fix crash when TimePicker.Time is set to null (backport from PR [#&#8203;32660](dotnet/maui#32660)) by [@&#8203;Copilot](https://github.com/Copilot) in dotnet/maui#32715

    <details>
    <summary>🔧 Fixes</summary>

    -   [Fix crash when TimePicker.Time is set to null](dotnet/maui#32660)

    </details>

##### Gestures

-   \[release/10.0.1xx-sr1] predictive back gesture support for Android 13+ by [@&#8203;github-actions](https://github.com/github-actions)\[bot] in dotnet/maui#32635

    <details>
    <summary>🔧 Fixes</summary>

    -   [predictive back gesture support for Android 13+](dotnet/maui#32461)

    </details>

##### Infrastructure

-   \[release/10.0.1xx-sr1] \[ci] Revert changes setting Creator by [@&#8203;github-actions](https://github.com/github-actions)\[bot] in dotnet/maui#32803

    <details>
    <summary>🔧 Fixes</summary>

    -   [\[ci\] Revert changes setting Creator](dotnet/maui#32743)

    </details>

##### Mediapicker

-   \[release/10.0.1xx-sr1] \[Android] Refactor selection limit handling in MediaPicker by [@&#8203;github-actions](https://github.com/github-actions)\[bot] in dotnet/maui#32628

    <details>
    <summary>🔧 Fixes</summary>

    -   [\[Android\] Refactor selection limit handling in MediaPicker](dotnet/maui#32571)

   ...
@github-actions github-actions bot locked and limited conversation to collaborators Dec 15, 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.

MediaPicker.Default.PickPhotosAsync() throws NRE on Maui 10 for Android

2 participants