Skip to content

[BUG] App crash using Maui.Camera on Surface Go 2 and 3s (Windows) #3050

@HelenMamalakiV1

Description

@HelenMamalakiV1

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

Taking a photo on a Surface Go 2 or 3 cause the app to crash immediately with the following Exception. It's worse on a Surface Go 2 then on a 3.

Exception:
System.Runtime.InteropServices.COMException: This object needs to be initialized before the requested operation can be carried out.
This object needs to be initialized before the requested operation can be carried out.

Stacktrace:
IReadOnlyDictionary<string, MediaFrameSource> MediaCapture.get_FrameSources()
//src/CommunityToolkit.Maui.Camera/CameraManager.windows.cs in async void d__22.MoveNext() at line 152:3
/
/src/CommunityToolkit.Maui.Camera/CameraManager.windows.cs in async void d__23.MoveNext() at line 132:3
/_/src/CommunityToolkit.Maui.Camera/Handlers/CameraViewHandler.shared.cs in async void CameraViewHandler.ConnectHandler(FrameworkElement platformView) at line 87:3
Called from: Task.cs in void Task.ThrowAsync(Exception exception, SynchronizationContext targetContext)+(object state) => { }

Expected Behavior

The app should not crash.
May be related: #2559 - although the current exception is different.

Steps To Reproduce

The key to replicating is taking a photo on a Surface Go 2 and 3. The existing Toolkit code sample can be use to replicate.

Link to public reproduction project repository

Repo sample

Environment

- .NET MAUI CommunityToolkit:CommunityToolkit.Maui.Camera 5.0
- OS: Windows 11
- .NET MAUI: 10

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions