The following forum(s) are migrating to a new home on Microsoft Q&A (Preview): Developing Universal Windows apps!

Ask new questions on Microsoft Q&A (Preview).
Interact with existing posts until December 13, 2019, after which content will be closed to all new and existing posts.

Learn More

 none
Photo chooser returning Cancel on device RRS feed

  • Question

  • Photo chooser works fine in emulator. When I test on device it returns TaskResult = Cancel . I read that Zune interfers with photo chooser so I closed zune and ran WPConnect. WPConnect says Connection established. but still no joy.

    What am I doing wrong.
    Wednesday, January 5, 2011 4:20 AM

Answers

All replies

  • In order to help you, you need to post the code thats crashing + the exception + the callstack.
    Wednesday, January 5, 2011 5:13 AM
  • Thanks JMV Software.

    There is no crash + exception + call stack. The photo chooser returns 'Cancel'. as if cancled by the OS. Only happend on the device works fine in emulator.

    private void btnPictureChooser_Click(object sender, RoutedEventArgs e)
    {
    objPhotoChooser.Show();
    }

    void objPhotoChooser_Completed(object sender, PhotoResult e)
    {
    if (e == null || e.TaskResult != TaskResult.OK) return;
    // more code here that does not get executed because e.TaskResult = 'Cancel'

    Ideas Anyone
    Thursday, January 6, 2011 2:26 AM
  • This now appears to be working fine. As far as I know I did not a change anything
    Thursday, January 6, 2011 3:34 AM
  • I've also seen some strange behavior with this as well - specifically the PhotoChooser task would immediately return with a Cancel without even displaying the media library when in debug mode (fine outside of debug).  Somewhere along the line this started working for me.
    Thursday, January 6, 2011 6:12 AM
  • If it returns cancel what would happen if you try to call it again? Does this only happen in debug builds?  When your debugging?  I haven't personally experimented with it but posting exact ways to reproduce the problem will help MS dev's to reproduce it and fix the bug. Also I would file a connect ticket when you can find EXACT ways to reproduce the bug.
    Thursday, January 6, 2011 6:18 PM
  • The reason this is happening is because you're debugging whilst Zune software is running. In order to debug any form of media, you should use WPConnect instead of the Zune software. You can get information on WPConnect in this blog post. I've also written a post explaining how to integrate WPConnect into Visual Studio for easy access.
    Thursday, January 6, 2011 6:40 PM
  • The reason this is happening is because you're debugging whilst Zune software is running. In order to debug any form of media, you should use WPConnect instead of the Zune software. You can get information on WPConnect in this blog post. I've also written a post explaining how to integrate WPConnect into Visual Studio for easy access.

    Drr I should have thought of that, the same thing happens when your connected to zune and you try to play a video...excellent catch.
    Thursday, January 6, 2011 7:26 PM
  • Drr I should have thought of that, the same thing happens when your connected to zune and you try to play a video...excellent catch.

    Yup, it catches me out sometimes after I've downloaded a game via the Zune software and I run it straight away :). Most games don't check to see if the device is connected and just shut down immediately.
    Thursday, January 6, 2011 7:28 PM
  • Photo chooser works fine in emulator. When I test on device it returns TaskResult = Cancel . I read that Zune interfers with photo chooser so I closed zune and ran WPConnect. WPConnect says Connection established. but still no joy.

    What am I doing wrong.


    Hi, i confirm the exactly same problem : task return cancel when connected to my PC and Zune launched.
    Sunday, May 15, 2011 9:17 AM

  • Hi, i confirm the exactly same problem : task return cancel when connected to my PC and Zune launched.

    Zune should not be launched. When debugging media, you should connect your device with WPConnect and not the Zune software. If you're still getting the error, it might be code related. 
    Sunday, May 15, 2011 2:27 PM
  • I had a very similar problem to Bachmann and invirtux, and the easiest way I found to work around it was to simply unplug the device and run it in deployed mode instead of in debugging mode when testing the photochoosertask. Obviously this is not as useful for debugging, but worked consistently. Additionally, I had this problem a few times in the emulator (which is very weird). When it was running the emulator in debugging mode, it would fail to launch the photochooser, but when running in "deployed" mode on the emulator it worked just fine. This problem seemed slightly sporadic, but is still worth mentioning (I am running 7.1 beta 2 SDK, but my phone is still running 7.0 with all public updates. App was developed for 7.0 devices)
    Friday, July 1, 2011 4:40 PM