Skip to content

Conversation

@ne0rrmatrix
Copy link
Contributor

This pull request focuses on fixing an issue where updating Dotnet Maui to 9.0.120 and updating workloads will prevent Camera package from building successfully. Updates AndroidX Camera NuGet packages to newer versions, and makes minor corrections to UI data bindings.
Dependency Updates:

  • Updated AndroidX Camera NuGet packages (Xamarin.AndroidX.Camera.Camera2, Xamarin.AndroidX.Camera.View, Xamarin.AndroidX.Camera.Extensions) from version 1.4.2.2 to 1.5.0, and added Xamarin.AndroidX.Activity.Ktx version 1.11.0 to the Android project.

UI/Data Binding Fixes:

  • Corrected the ItemDisplayBinding in CameraViewPage.xaml to properly bind the camera name from the selected camera.

These changes collectively improve the stability and maintainability of the camera features, especially in scenarios where hardware or system APIs may return null values. ### Description of Change ###

Linked Issues

  • Fixes #

PR Checklist

  • Has a linked Issue, and the Issue has been approved(bug) or Championed (feature/proposal)
  • Has tests (if omitted, state reason in description)
  • Has samples (if omitted, state reason in description)
  • Rebased on top of main at time of PR
  • Changes adhere to coding standard
  • Documentation created or updated: https://github.com/MicrosoftDocs/CommunityToolkit/pulls

Additional information

Updated Camera package version to address issues with Android transitory packages error that prevents builds. This may not affect all users. I noticed it tonight. It was building fine yesterday. I did update the workloads.

Enhanced null safety across CameraManager.android.cs by adding null-conditional operators (`?`) to prevent potential null reference exceptions. Updated `CameraViewPage.xaml` to bind `Picker` to `SelectedCamera.Name` for accurate UI display.

Upgraded `Xamarin.AndroidX.Camera` dependencies to version 1.5.0 and added `Xamarin.AndroidX.Activity.Ktx` for improved functionality and compatibility. Adjusted `CameraProvider.android.cs` to handle null values and ensure robust camera initialization.
Copilot AI review requested due to automatic review settings October 27, 2025 05:07
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 addresses a build failure in the Camera package that occurs after updating to .NET MAUI 9.0.120 by updating AndroidX Camera dependencies and adding null-safety checks throughout the Android camera implementation.

  • Updates AndroidX Camera NuGet packages from version 1.4.2.2 to 1.5.0 and adds Xamarin.AndroidX.Activity.Ktx dependency
  • Adds null-conditional operators throughout Android camera code to prevent potential null reference exceptions
  • Corrects data binding in the sample app's camera picker UI

Reviewed Changes

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

File Description
CommunityToolkit.Maui.Camera.csproj Updates AndroidX Camera packages to v1.5.0 and adds Activity.Ktx dependency
CameraProvider.android.cs Adds null-safety checks for camera characteristics and info objects
CameraManager.android.cs Adds extensive null-conditional operators throughout camera initialization and capture code
CameraViewPage.xaml Fixes ItemDisplayBinding to correctly reference camera name property

ne0rrmatrix and others added 3 commits October 26, 2025 23:54
Updated CameraViewPage.xaml to fix data binding issues by modifying the `ItemDisplayBinding` property of the `Picker`.

Enhanced CameraManager.android.cs with the following changes:
- Improved resolution selection logic in `UpdateCaptureResolution` by prioritizing higher resolution over capture rate.
- Enhanced image capture quality in `StartUseCase` by setting capture mode to maximize quality and applying the resolution selector.
- Added audio support and proper initialization for video recording in `PlatformStartVideoRecording`.

These changes improve the overall functionality and quality of the camera features.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant