Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] CameraView: Rapidly capturing a picture throws an uncatchable exception (Windows, iOS) #2208

Open
2 tasks done
tschbc opened this issue Sep 16, 2024 · 0 comments
Open
2 tasks done
Labels
bug Something isn't working unverified

Comments

@tschbc
Copy link

tschbc commented Sep 16, 2024

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

After waiting for Camera.StartCameraPreview to complete, taking pictures rapidly throws an uncatchable exception, crashing the app.

On Windows it's not as bad: you need to double-click a shutter button soon after the camera preview becomes active. If you single click, then wait a few seconds, no amount of rapid clicking will crash the app.

On iOS, you can consistently crash the app by double-tapping a shutter button at any point after the preview becomes active.

Edit: it looks like the ValueTask returned from Camera.StartCameraPreview never completes, execution stays halted. The first Camera.CaptureImage call throws a TaskCanceledException from Camera.StartCameraPreview that breaks out. If you only capture one image, wait about 4-ish seconds and capture more images, no more TaskCanceledExceptions are thrown (on Windows at least).

Expected Behavior

Throw an exception that can be caught—or some other ideal error state that is feasible.

Steps To Reproduce

  1. Run solution from repro repo
  2. Windows: double-click the "Take photo" button soon after the camera preview is active
  3. Observe uncatchable exception and crash.
  4. iOS: at any point after the camera preview has loaded, double-tap the "Take photo" button
  5. Observe uncatchable exception and crash.

Link to public reproduction project repository

https://github.com/tschbc/CmtyToolkitCameraViewIssues

Environment

- .NET MAUI CommunityToolkit: 9.0.3
- OS: Windows 10 19045.4780
- OS: iOS 17.6.1
- .NET MAUI: 8.0.90

Anything else?

No response

@tschbc tschbc added bug Something isn't working unverified labels Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working unverified
Projects
None yet
Development

No branches or pull requests

1 participant