CommunityToolkit / CommunityToolkit/Maui

[BUG] CameraView crashes if exited too quickly on Windows

Open
#3,171 2 comments 0 reactions 0 assignees View on GitHub
bug unverified
Dominant language
C#
Stars
2.7k
Forks
500
Avg merge
2d 14h
Merged PRs (30d)
7

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

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

- [x] I have read the "Reporting a bug" section on Contributing file: https://github.com/CommunityToolkit/Maui/blob/main/CONTRIBUTING.md#reporting-a-bug

### Current Behavior

On Windows, if the app exits from the CameraView page while the view is still loading, the app crashes with an exception:

Image





This can happen if user click the "back" button quickly enough to navigate away from the CameraView when the view is still loading

### Expected Behavior

The app should not crash

### Steps To Reproduce

1. Open and run project from the reproduction repo
2. Click the "Open and exit camera page" button. This button simulates opening the camera view page and navigate back by `Navigation.PopAsync()` after a certain time delay. Optionally set the time delay for camera page to exit, default is 50ms.
3. Observe the bug

### Link to public reproduction project repository

https://github.com/zhitaop/MctCameraViewSample

### Environment

```markdown
- .NET MAUI CommunityToolkit.Maui.Camera: v6.0.0
- OS: Windows 11 Enterprise
- .NET MAUI: 10.0.41
```

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.