Skip to content

[BUG] CameraView StopCameraPreviewCommand is not working #3156

@zhitaop

Description

@zhitaop

Is there an existing issue for this?

  • I have searched the existing issues

Did you read the "Reporting a bug" section on Contributing file?

Current Behavior

The CameraView.StopCameraPreviewCommand is not working correctly. When binding this command to a button, the app raises the following exception:

System.InvalidCastException: 'Unable to cast object of type 'Microsoft.Maui.Controls.Command' to type 'Microsoft.Maui.Controls.Command`1[System.Threading.CancellationToken]'.'

Image

Expected Behavior

The StopCameraPreviewCommand should work as expected.

Steps To Reproduce

  1. Run the CommunityToolkit.Maui.Sample app with the latest main branch on Windows (Note: might have to revert the commit 9aca2fc due to the issue [BUG] CommunityToolkit sample app crashes opening CameraView page on Windows #3155)
  2. Open the CameraView Page from the Views side menu
  3. Observe that the above exception is thrown
  4. Continue running the app. Observe that the "Stop Camera Preview" button does not work as expected.

Link to public reproduction project repository

https://github.com/CommunityToolkit/Maui/tree/main/samples

Environment

- .NET MAUI CommunityToolkit: v14.0.1
- .NET MAUI CommunityToolkit.Maui.Camera: v6.0.0
- OS: Windows 11 Enterprise
- .NET MAUI: 10.0.41

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions