Răspuns Criteria for getting shut down by the OS?

  • Friday, May 11, 2012 1:28 PM
     
     

    Is there a list of conditions under which an application will get shut down by the OS?

    The reason I'm asking is: in order to test our HTML5/JavaScript Metro-style app, I wrote a test-runner that installs the package, starts the application, waits for it to finish, collects the test results and uninstalls the package again.

    This is working fine when invoked from the command line or from within Visual Studio. But when run from Jenkins, our CI system, the application gets interrupted while running the tests. The exit code for the process spawned via IApplicationActivationManager is 0.

    Manually bringing the app to the foreground doesn't help. My guess is that maybe Windows includes the memory footprint of the spawning process against some limit, finds the Java Runtime and decides it's a greedy app that needs to be shut down.

    When configuring the app to run (any combination of) fewer tests so that it takes less time, everything works great so I'm thinking there may be a timer involved.

    Hoping for hints and suggestions

    Marcus

All Replies

  • Friday, May 11, 2012 2:11 PM
     
     
    Update: I just found that my earlier assumption is totally bogus because the WWAHost spawned via IApplicationActivationManager isn't a child process of the application that activates the application. So I'm even more baffled as to the circumstances of the application exiting prematurely when run via CI.
  • Friday, May 11, 2012 8:02 PM
    Moderator
     
     Answered

    Hi Marcus,

    Your app should only be active when it is in the foreground (the OS enforces this).

    If you app is suspended (not in the foreground) and the OS determines there is memory pressure, it can transition the app from suspended to terminated.

    See this for the complete picture:

    http://msdn.microsoft.com/en-us/library/windows/apps/hh464925.aspx

    -Jeff


    Jeff Sanders (MSFT)

  • Saturday, May 12, 2012 2:46 AM
    Moderator
     
     Answered

    Your test harness can use the IPackageDebugSettings interface to put the app into a debug mode and disable suspend. This is how the Visual Studio debugger can let you switch between the app and VS without the app suspending.

    --Rob

  • Monday, May 14, 2012 8:22 AM
     
     

    Hello Rob,

    who implements this IPackageDebugSettings interface? IApplicationActivationManager?

  • Monday, May 14, 2012 9:40 AM
    Moderator
     
     

    It's implemented by the CLSID_PackageDebugSettings object.

    There is a non-Microsoft project at http://winrt.codeplex.com you can take a look at for an example of implementing this. It may still not be updated for the Consumer Preview, but it should give general overview of what you can do with this interface.

    --Rob


  • Monday, May 14, 2012 9:45 AM
     
     Answered
    Rob, there is no winrtdebug.codeplex.com project, its http://winrt.codeplex.com/