public void Start() { // Set up unhandled exception handlers #if DEBUG // In debug builds we'd prefer to have it dump us into the debugger #else AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException); #endif // Initialize some misc. Windows Forms settings Application.SetCompatibleTextRenderingDefault(false); Application.EnableVisualStyles(); UI.EnableDpiAware(); // If any files are missing, try to repair. // However, support /skipRepairAttempt for when developing in the IDE // so that we don't needlessly try to repair in that case. if (this.args.Length > 0 && string.Compare(this.args[0], "/skipRepairAttempt", StringComparison.InvariantCultureIgnoreCase) == 0) { // do nothing: we need this so that we can run from IDE/debugger // without it trying to repair itself all the time } else { if (CheckForImportantFiles()) { Startup.StartNewInstance(null, false, args); return; } } // The rest of the code is put in a separate method so that certain DLL's // won't get delay loaded until after we try to do repairs. StartPart2(); }