// This program runs as part of an automated test system so you need // to prevent the normal Unhandled Exception behavior (Watson dialog). // Instead, print out any exceptions and exit with an error code. [HandleProcessCorruptedStateExceptions] public static int Main() { try { // Catch any exceptions leaking out of the program CallMainProgramLoop(); } catch (Exception e) // We could be catching anything here { // The exception we caught could have been a program error // or something much more serious. Regardless, we know that // something is not right. We'll just output the exception // and exit with an error. We won't try to do any work when // the program or process is in an unknown state!