I have a bootstrapping application with a rather big chain; for some exepackages I use the ExitCode with Behavior=”scheduleReboot”
<ExePackage Id="somepkg">
<ExitCode Behavior="scheduleReboot" Value="0" />
<ExitCode Behavior="error" />
...
</ExePackage>
and in OnApplyComplete that is correctly parsed:
if (ea.Restart == ApplyRestart.RestartRequired)
{
Engine.Log(LogLevel.Error, $"A restart is required by the Bootstrapping application");
restartNeeded = true;
}
and I add to the OnShutdown the following
private void OnShutDown(object sender, ShutdownEventArgs args)
{
if (restartNeeded)
{
Engine.Log(LogLevel.Error, $"BOOTSTRAPPER_SHUTDOWN_ACTION.Restart invoked");
args.Action = BOOTSTRAPPER_SHUTDOWN_ACTION.Restart;
}
}
but what happens when I look at the log:
[0208:0334][2024-05-22T12:11:11]e000: A restart is required by the Bootstrapping application
[0208:0334][2024-05-22T12:11:12]i399: Apply complete, result: 0x0, restart: Required, ba requested restart: No
[0208:1B48][2024-05-22T12:25:08]i000: Exiting custom bootstrapping application with return value 0.
[0208:0334][2024-05-22T12:25:08]i500: Shutting down, exit code: 0x0
[0208:0334][2024-05-22T12:25:08]e000: BOOTSTRAPPER_SHUTDOWN_ACTION.Restart invoked
[0208:0334][2024-05-22T12:25:08]i004: Bootstrapper application requested restart at shutdown. Planned to restart already: No.
the change in the bool is also checked in a UI Dialogue so the user can opt out – but then the value would be false.
My question is: if BOOTSTRAPPER_SHUTDOWN_ACTION.Restart does not do the trick of planning to restart on close of the BA, how can I do it? I looked for some documentation but didnt find too much.
all pointers appreciated, but I suppose this is probably some total oversight on my part.