I am writing a task scheduler to manage a large number of distributed jobs. The jobs themselves are C# console applications running on .Net 4.6, and controlled by a local agent. Many of these jobs crash, throwing a .Net exception, which launches the annoying window to attach a debugger or close. I have written the agent to attach as a debugger in order to prevent this popup, and to also kill all running jobs in case the agent is closed (they act like child processes in this way), using the example from Kill child process when parent process is killed
My next goal is to be able to read the exception and stack trace in case of a job crashing. How can I read out the exception information as a managed debugger?