Task.Delay() triggers cancellation of application lifetime
问题 I have faced a situation when Task.Delay() method would trigger an event of cancellation in IApplicationLifetime . Here is the code: static async Task Main(string[] args) { Console.WriteLine("Starting"); await BuildWebHost(args) .RunAsync(); Console.WriteLine("Press any key to exit.."); Console.ReadKey(); } private static IHost BuildWebHost(string[] args) { var hostBuilder = new HostBuilder() .ConfigureHostConfiguration(config => { config.AddEnvironmentVariables(); config.AddCommandLine(args)