-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
37 lines (36 loc) · 1.24 KB
/
Program.cs
File metadata and controls
37 lines (36 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
namespace Neolution.DotNet.Console.Demo
{
/// <summary>
/// The program
/// </summary>
public static class Program
{
/// <summary>
/// Defines the entry point of the application.
/// </summary>
/// <param name="args">The arguments.</param>
/// <returns>The <see cref="Task"/>.</returns>
public static async Task Main(string[] args)
{
try
{
var builder = DotNetConsole.CreateDefaultBuilder(args);
DotNetConsoleLogger.Initialize(builder.Configuration);
var startup = new Startup(builder.Environment, builder.Configuration);
startup.ConfigureServices(builder.Services);
var console = builder.Build();
await console.RunAsync();
}
catch (Exception ex)
{
DotNetConsoleLogger.Log.Error(ex, "Stopped program because of an unexpected exception");
throw;
}
finally
{
// Ensure to flush and stop internal timers/threads before application-exit (Avoid segmentation fault on Linux)
DotNetConsoleLogger.Shutdown();
}
}
}
}