WindowsPhone8Demo crash

Jul 16, 2014 at 8:10 AM
Edited Jul 16, 2014 at 8:24 AM
WindowsPhone8Demo, the demo I used, first I enter the captureView, then I put it to the background, and when I resume the app to the front desk, it will crash.

if I comment out "await PhotoCaptureDevice.FocusAsync();" , it will not crash again.

I guess the following code should be the origins of the crash. The Task may be not stopped from the while circulation. I'd really appreciate any help I could get.
private async void Focusing()
        {
            while (!stop)
            {
                if (PhotoCaptureDevice.IsFocusSupported(sensorLocation))
                {

                    await PhotoCaptureDevice.FocusAsync();

                }
                else
                    System.Threading.Thread.Sleep(200);
            }

            PhotoCaptureDevice.PreviewFrameAvailable -= PreviewFrame;
            PhotoCaptureDevice.Dispose();
            PhotoCaptureDevice = null;
        }
Coordinator
Jul 22, 2014 at 8:07 PM
Perhaps the Deactivated event (and/or OnNavigatedFrom) isn't handled correctly or the Stop method of the class CaptureViewModel isn't called.
Or you add a try-catch block around the while loop and look into the exception.
I can't test it because I don't own a WP device.