locked
CameraCaptureUI.CaptureFileAsync - camera stopped working

    Question

  • I'm developing a Windows Store app that uses CameraCaptureUI.CaptureFileAsync() to capture photos.  I'm developing on a Thinkpad with Windows 8.1 that does not have an integrated camera, but it's been working fine with a Logitech QuickCam connected via USB.  The app has been working great; the API call pops up the UI, captures an image, allows me to crop, etc. and returns the image back to the main application.

    During testing, I selected a different resolution in the Photo Resolution combo box, at which point the image preview stopped displaying and instead showed an error: "There's a problem with the camera."  OK, perhaps the camera doesn't support that particular resolution. But now the dialog box won't operate at all: the Photo Resolution combo box is grayed out with nothing selected, the Change Camera button does nothing, and the screen just says "There's a problem with the camera."

    I uninstalled the camera in Settings, unplugged it, rebooted, and plugged the camera back in.  Windows detected it and installed it just fine.  But when I ran my app again, same problem: just "There's a problem with the camera."

    Note that the camera itself and the drivers seem fine: I can run the Camera app on the Start Screen and capture pictures with it successfully.  But there's now something about the application state and the CaptureFileAsync() method that is preventing the custom app from capturing images with the camera.

    Any ideas?

    Tuesday, March 18, 2014 7:26 PM

Answers

  • Thanks for the reply, Rob.

    This is interactively through Visual Studio, so the app isn't really installed or available for uninstallation. 

    As an ugly workaround, I finally resorted to deleting the package folder from %userdir%\AppData\Local\Packages\{guid}. (At that point, I got a FileNotFound exception when calling the CaptureFileAsync() method.) Running the Deploy Solution command in Visual Studio didn't do the trick, but I then changed the minor version number of the application in the manifest, which forced Visual Studio to re-deploy the package upon a Rebuild All. Since then, it's back to working fine, even after reverting the minor version number in the manifest.

    Strange behavior to be sure: I suspect that there's some state being cached (perhaps in the ...Packages\{guid}\Settings\settings.dat file?) that was triggering this, and it seems like buggy behavior either within Windows or Visual Studio.  But in any event, the camera is working again within the app, and I can continue development.  Thanks.

    Wednesday, March 19, 2014 3:33 AM

All replies

  • How are you setting the PhotoSettings? Are you caching the data?

    Does the state reset itself if you uninstall and reinstall the app?

    Wednesday, March 19, 2014 3:00 AM
    Owner
  • Thanks for the reply, Rob.

    This is interactively through Visual Studio, so the app isn't really installed or available for uninstallation. 

    As an ugly workaround, I finally resorted to deleting the package folder from %userdir%\AppData\Local\Packages\{guid}. (At that point, I got a FileNotFound exception when calling the CaptureFileAsync() method.) Running the Deploy Solution command in Visual Studio didn't do the trick, but I then changed the minor version number of the application in the manifest, which forced Visual Studio to re-deploy the package upon a Rebuild All. Since then, it's back to working fine, even after reverting the minor version number in the manifest.

    Strange behavior to be sure: I suspect that there's some state being cached (perhaps in the ...Packages\{guid}\Settings\settings.dat file?) that was triggering this, and it seems like buggy behavior either within Windows or Visual Studio.  But in any event, the camera is working again within the app, and I can continue development.  Thanks.

    Wednesday, March 19, 2014 3:33 AM