Tips for debugging WP7 media apps with WPConnect

Monday’s blog post on  running under screen lock generated a couple of questions around media not playing when medialibrary is locked ( and Zune locking Media Library).
So, today, I remind you about a recently announced tool that shipped with the Windows Phone Developer Tools October Update.

The tool is called Windows Phone Connect Tool ( internally we know it as either WPDTConnect, or WPConnect, the latter is the final name of the exe as it made it out externally).
Full instructions on running and troubleshooting WPConnect are here.   My personalized version is below.

Requirements:

  • Of course, this requires you have the WIndows Phone Developer Tools installed (dah!) . Get the tools from here
  • This also requires you have a version of Zune capable of connecting to Windows Phone. That is version 4.7.1404.  Get it from here
    You will not be running Zune during the debugging, but WPConnect is still using some of that infrastructure that Zune installs.
  • At last, you need to install the WPDT October Update.  Get it from here.

To run WPConnect:
You simply need to run the WPConnect.exe. 
By default it will be installed at  %ProgramFiles%\Microsoft SDKs\Windows Phone\v7.0\Tools\ or at %ProgramFiles(x86)%\Microsoft SDKs\Windows Phone\v7.0\Tools\WPConnect.
The instructions on MSDN talk about opening a command prompt and navigating to that directory; that is Microsoft internal instructions. For the rest of the world that does not use DOS and command prompt as much as we do inside , you can do any of these and it will work equally well.

    • Run WPConnect from a short-cut on your desktop. 
    • Copy the WPConnect executable some where in your path or your desktop or what ever and run it.

The really important stuff is to:

  1. Do connect once with Zune before running WPConnect. As I mentioned, the infrastructure is shared.
  2. Make sure you stop Zune before you run WPConnect.
  3. Run WPConnect [any way you want, command prompt not required]

The results:
What you  will get is ability to debug applications that play Media on the phone without media library getting locked. You can also debug applications that interact with MediaLibrary.

A couple of FAQs and or known issues:

  • The update to the tools is an MSP. It is pretty silent. Run it and as long as you do not get an error you will be fine. If you need to test if it succeeded, check for WPConnect.
  • There is no significant advantage or disadvantage between debugging using WPConnect and/or Zune. One is not faster than the other or any thing like that. It is same communication services underneath.
  • WPConnect runs for a few seconds and then exits.  This is expected, don’t be looking for it in taskmgr. If you launch it and it says it connected, you will be able to debug for hours without having to relaunch it. It is like a silent ninja, you don’t see it but it is there ready to strike.
  • Launching Zune any time after WPConnect is running will disconnect WPConnect. This most often happens if you disconnect your phone and connect it again.  The workaround is to close Zune and WPConnect again. 

That should be all you need.  Read the full instructions for more troubleshooting tips. Hope that helps.

Happy Windows Phone coding!