locked
What is the difference between ApplicationExecutionState::Terminated and ApplicationExecutionState::NotRunning

    Question

  • I'm confused--the documentation is scarce.  In the samples I'm seeing the test for Terminated, but why not for NotRunning? My expectation is that NotRunning is the initial state of an application--until it loads, where it transitions to Running and then to Suspended/Running/Suspended/Running, etc., until it is kicked out by the runtime and then it transitions toTerminated.

     

    Can anyone clarify?

    Sunday, October 9, 2011 7:09 AM

All replies

  • I'll follow-up to get more detail in the docs. Thanks for pointing this out!

    Terminated means the application had previously executed in the session and terminated normally.

    NotRunning means the application has either not executed yet or had executed but terminated unexpectedly (crashed for example).

    Thanks!

    -David

    Wednesday, October 12, 2011 9:49 PM
    Moderator
  • @david,

    My assumption is that Terminated is then used to load a potential state saved onto permanent storage.  If the application is loaded for the first time on the machine, I would get a NotRunning, no saved state is available, so it would have to be created.  All other executions of the app would provide Terminated.

    However, assume I receive a Terminated, then load saved state, then the application crashes...the next event, the way I understand your post, is that I would receive a NotRunning.  In that case, how can I discriminate between NotRunning - first time it is launched (the ActivationKind enumeration would contain a 0-Launch) and NotRunning - app crashed but I have saved state!

    With this in mind it seems to me that I should be checking for both every time (otherwise, recovering after a crash would not load state).  Can you clarify further?  Thx!

    Tuesday, October 25, 2011 4:46 PM