UWP: CameraCaptureUI starts new Camera Task if no photo is taken

Anonymous
2019-12-05T08:18:58.017+00:00

Hello,

i have a Xamarin.Forms app. In the UWP project i have code to take an photo which i call using the DependencyService.

The code is very similar to the example code from here: https://learn.microsoft.com/en-us/uwp/api/windows.media.capture.cameracaptureui

public async Task TakePhoto()  
{  
	CameraCaptureUI captureUI = new CameraCaptureUI();  
	captureUI.PhotoSettings.Format = CameraCaptureUIPhotoFormat.Jpeg;  
	captureUI.PhotoSettings.CroppedSizeInPixels = new Windows.Foundation.Size(200, 200);  
	StorageFile photo = await captureUI.CaptureFileAsync(CameraCaptureUIMode.PhotoOrVideo);  
  
	if (photo == null)  
		return;  
}  
  

What happens:

  • The camera opens as desired
  • if i take a photo everything is fine
  • if i decide to close the camera app using the x in the top right corner, the camera app is closed as desired
  • but i can see a new "Camera" thread in task manager
  • This new thread is blocking other apps from using the camera (e.g. barcode scanner)

This behavior is reproducible with other apps already in the store (e.g. Ultimate Photo Editor).

My test device is an "Surface Go Model 1824" and i'am using "Rear" camera, not the "Front" camera.

Kind Regards

Matthias

Universal Windows Platform (UWP)
{count} votes