private static int Main(string[] args) {
ConfigureAssemblyResolution();
try {
InnerMain(args);
}
catch (CatchyException e) {
using (Color(ConsoleColor.Red)) {
WriteExceptionMessage(e);
WriteExceptionStackTrace(e);
}
return -1;
}
catch (ReflectionTypeLoadException rtle) {
using (Color(ConsoleColor.Red)) {
WriteExceptionMessage(rtle);
WriteExceptionStackTrace(rtle);
foreach (var le in rtle.LoaderExceptions) {
Console.WriteLine(le.Message);
}
}
return -1;
}
catch (TargetInvocationException e) {
using (Color(ConsoleColor.Red)) {
Console.WriteLine();
Console.WriteLine("Encountered a problem instantiating the configuration object");
WriteExceptionMessage(e);
WriteExceptionStackTrace(e);
}
var rtle = e.InnerException as ReflectionTypeLoadException;
if (rtle != null) {
foreach (var le in rtle.LoaderExceptions) {
WriteExceptionMessage(le);
}
}
return -1;
}
catch (Exception e) {
using (Color(ConsoleColor.Red)) {
Console.WriteLine("Caught unhandled {0}", e.GetType().Name);
WriteExceptionMessage(e);
}
WriteExceptionStackTrace(e);
return -1;
}
return 0;
}