public static int Main(string[] args) { var pg = new Program(); try { return pg.main(args); } catch (Exception ex) { // NB: Normally this is a terrible idea but we want to make // sure Setup.exe above us gets the nonzero error code Console.Error.WriteLine(ex); return -1; } }
public static int Main(string[] args) { var pg = new Program(); try { return(pg.main(args)); } catch (Exception ex) { // NB: Normally this is a terrible idea but we want to make // sure Setup.exe above us gets the nonzero error code Console.Error.WriteLine(ex); return(-1); } }
public static int Main(string[] args) { var pg = new Program(); try { return(pg.main(args)); } catch (AggregateException ex) { Console.Error.WriteLine(ex); var installing64bitOn32Bit = ex.InnerExceptions.OfType <Win32Exception>().Any(i => i.NativeErrorCode == ERROR_EXE_MACHINE_TYPE_MISMATCH); return(installing64bitOn32Bit ? -2 : -1); } catch (Exception ex) { // NB: Normally this is a terrible idea but we want to make // sure Setup.exe above us gets the nonzero error code Console.Error.WriteLine(ex); return(-1); } }