public static int Main() { int functionReturnResult = -1; using (var app = new App()) { Action applicationAction = () => { app.InitializeComponent(); app.Run(); functionReturnResult = NormalApplicationExitCode; }; using (var processor = new LogBasedExceptionProcessor( LoggerBuilder.ForFile( Path.Combine(FileConstants.LogPath(), DefaultErrorFileName), new DebugLogTemplate(new NullConfiguration(), () => DateTimeOffset.Now)))) { var result = TopLevelExceptionGuard.RunGuarded( applicationAction, new ExceptionProcessor[] { processor.Process, }); return((result == GuardResult.Failure) ? UnhandledExceptionApplicationExitCode : functionReturnResult); } } }
static int Main(string[] args) { { Debug.Assert(args != null, "The arguments array should not be null."); } int functionReturnResult = -1; using (var processor = new LogBasedExceptionProcessor( LoggerBuilder.ForFile( Path.Combine(FileConstants.LogPath(), DefaultErrorFileName), new DebugLogTemplate(new NullConfiguration(), () => DateTimeOffset.Now)))) { var result = TopLevelExceptionGuard.RunGuarded( () => functionReturnResult = RunApplication(args), new ExceptionProcessor[] { processor.Process, }); return((result == GuardResult.Failure) ? UnhandledExceptionApplicationExitCode : functionReturnResult); } }