[Android] Refactor selection limit handling in MediaPicker#32571
Merged
jfversluis merged 1 commit intodotnet:mainfrom Nov 14, 2025
Merged
[Android] Refactor selection limit handling in MediaPicker#32571jfversluis merged 1 commit intodotnet:mainfrom
jfversluis merged 1 commit intodotnet:mainfrom
Conversation
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.
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. |
Contributor
There was a problem hiding this comment.
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
selectionLimitvariable that safely handles null options with a default value of 1 - Replaced direct
options.SelectionLimitaccesses with the null-safe local variable throughout the method
Member
|
/azp run MAUI-public |
|
Azure Pipelines successfully started running 1 pipeline(s). |
jfversluis
approved these changes
Nov 14, 2025
Member
|
/backport to release/10.0.1xx-sr1 |
Contributor
|
Started backporting to |
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 [@​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 [@​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 [#​32660](dotnet/maui#32660)) by [@​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 [@​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 [@​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 [@​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) ...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
maui/src/Essentials/src/MediaPicker/MediaPicker.ios.cs
Line 211 in 73ae2c9
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