When a form is closed, it gets a useful argument in its FormClosed event, CloseReason. However our app runs with only a tray icon and no windows open most of the time. When it exits, I'd like to log the reason it exited - in particular, knowing CloseReason.WindowsShutDown and CloseReason.TaskManagerClosing would be useful.
Is there any way to check for the above after Application.Run returns, in the absence of any Form instances?