Answered by:
Criteria for getting shut down by the OS?

Question
-
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
Friday, May 11, 2012 1:28 PM
Answers
-
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
- Marked as answer by Jeff SandersMicrosoft employee, Moderator Monday, May 14, 2012 12:36 PM
Saturday, May 12, 2012 2:46 AMModerator -
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)
- Proposed as answer by Jeff SandersMicrosoft employee, Moderator Friday, May 11, 2012 8:02 PM
- Marked as answer by Jeff SandersMicrosoft employee, Moderator Monday, May 14, 2012 12:36 PM
Friday, May 11, 2012 8:02 PMModerator -
- Edited by phil_ke Monday, May 14, 2012 9:46 AM
- Marked as answer by Jeff SandersMicrosoft employee, Moderator Monday, May 14, 2012 12:36 PM
Monday, May 14, 2012 9:45 AM
All replies
-
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 2:11 PM
-
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)
- Proposed as answer by Jeff SandersMicrosoft employee, Moderator Friday, May 11, 2012 8:02 PM
- Marked as answer by Jeff SandersMicrosoft employee, Moderator Monday, May 14, 2012 12:36 PM
Friday, May 11, 2012 8:02 PMModerator -
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
- Marked as answer by Jeff SandersMicrosoft employee, Moderator Monday, May 14, 2012 12:36 PM
Saturday, May 12, 2012 2:46 AMModerator -
Hello Rob,
who implements this IPackageDebugSettings interface? IApplicationActivationManager?
Monday, May 14, 2012 8:22 AM -
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
- Edited by Rob Caplan [MSFT]Microsoft employee, Moderator Thursday, May 17, 2012 12:02 AM fixed link
Monday, May 14, 2012 9:40 AMModerator -
- Edited by phil_ke Monday, May 14, 2012 9:46 AM
- Marked as answer by Jeff SandersMicrosoft employee, Moderator Monday, May 14, 2012 12:36 PM
Monday, May 14, 2012 9:45 AM