Process model for Windows Store-style (camera) device apps? RRS feed

  • Question

  • I have a Windows Store/Metro app that can be launched both "normally", through the start screen or whatever, but can also be launched as a device app.

    This app is used for automated testing purposes, so the main app calls CameraOptionsUI.Show multiple times. This is because we initialize new MediaCapture elements multiple times, and we need the device app to give us the pointer to our custom camera driver COM object.

    I initially thought each of these device apps were a separate process. However, throwing an unhandled exception in the device app also kills the main app (the one that called CameraOptionsUI.Show), and a global (static) variable set by the device app is subsequently visible in the main app. Thus, it seems to me that the device app is actually being run as a separate thread on the same app process.

    Thread-wise, what happens when I call CameraOptionsUI.Show, when the device app is the same app as the calling app?

    Is it possible to stop these old device apps that are no longer being used? I can't just exit the application, because that kills the main app as well. If the device "app" is simply a new thread, I'm not sure what I can do in C#. The Thread class is not available to Windows Store apps, and I don't even have a handle to the device app thread to work with.

    A more general question: if an app launches an instance of itself with a different entry point (this would also, for example, a file picker or share intent), are multiple processes created? If not, can we rely on using a global variable to pass around values between these apps?
    • Edited by __dong_ Thursday, July 11, 2013 1:17 AM
    Wednesday, July 10, 2013 7:28 PM

All replies

  • You can examine the process IDs in TaskManager or Process Explorer to see for yourself.

    You should find that you have only one instance of your process at a time. If there are multiple entries then they are in the same process and can share information.


    Thursday, July 11, 2013 3:11 AM
  • Rob, thank you very much. This is actually an app running on a tablet, so it was a bit tricky to use Task Manager. However, as far as I can tell, there is only one instance of the process, which means that the main app and device app must simply be separate threads.

    The better question is, is this behaviour documented, and can we assume it in code?

    Friday, July 12, 2013 8:16 PM