App.State.OnLeave is called first
Posted: Tue Jan 07, 2014 11:22 pm
When AppState is set from ZApplication.OnLoaded section, its OnLeave section is called before OnStart; it should not.
I also observed that after making some structural changes in a project, running the application (Alt+Enter) executes OnLeave section of the AppState which is not initially activated. This is really strange. However, this behavior seems to be non-deterministic and I cannot always reproduce it. It just sometimes happened.
To reproduce the bug, just run the attached project and watch the trace log -> "AppState1.OnLeave" appears before "AppState1.OnStart". (occasionally "AppState2.OnLeave" appears instead of "AppState1.OnLeave")
I also observed that after making some structural changes in a project, running the application (Alt+Enter) executes OnLeave section of the AppState which is not initially activated. This is really strange. However, this behavior seems to be non-deterministic and I cannot always reproduce it. It just sometimes happened.
To reproduce the bug, just run the attached project and watch the trace log -> "AppState1.OnLeave" appears before "AppState1.OnStart". (occasionally "AppState2.OnLeave" appears instead of "AppState1.OnLeave")