public static async Task Main(string[] args) { if (AppDomain.CurrentDomain.IsDefaultAppDomain()) { var setup = new AppDomainSetup(); setup.ShadowCopyFiles = "true"; var domain = AppDomain.CreateDomain("Rhetos.LanguageServices.Server SubDomain", AppDomain.CurrentDomain.Evidence, setup); try { domain.ExecuteAssembly(Assembly.GetExecutingAssembly().Location, args); } finally { AppDomain.Unload(domain); } } else { var programLogger = LogManager.GetLogger("Program"); var rhetosLanguageServer = new RhetosLanguageServer(programLogger); await rhetosLanguageServer.Run(); LogManager.Flush(); } }
public static async Task Main(string[] args) { var programLogger = LogManager.GetLogger("Program"); try { var rhetosLanguageServer = new RhetosLanguageServer(programLogger); await rhetosLanguageServer.Run(); } catch (Exception e) { programLogger.Fatal(() => $"Fatal exception encountered while running language server: {e}"); } LogManager.Flush(); LogManager.Shutdown(); }