diff --git a/src/ReportPortal.GaugePlugin/Program.cs b/src/ReportPortal.GaugePlugin/Program.cs index 3be07f7..a421455 100644 --- a/src/ReportPortal.GaugePlugin/Program.cs +++ b/src/ReportPortal.GaugePlugin/Program.cs @@ -11,19 +11,20 @@ namespace ReportPortal.GaugePlugin { - class Program { - private static ITraceLogger TraceLogger; + private static ITraceLogger TraceLogger { get; set; } - public static CancellationTokenSource ShutDownCancelationSource = new(); + public static CancellationTokenSource ShutDownCancellationSource { get; } = new(); [DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(Observers.FileResultsObserver))] [DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(Shared.Extensibility.Embedded.Analytics.AnalyticsReportEventsObserver))] [DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(Shared.Extensibility.Embedded.Normalization.RequestNormalizer))] + [DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(Shared.Extensibility.Embedded.LaunchArtifacts.LaunchArtifactsEventsObserver))] static async Task Main(string[] args) { - var gaugeProjectRoot = Environment.GetEnvironmentVariable("GAUGE_PROJECT_ROOT") ?? Environment.CurrentDirectory; + var gaugeProjectRoot = Environment.GetEnvironmentVariable("GAUGE_PROJECT_ROOT"); + Environment.CurrentDirectory = gaugeProjectRoot; var gaugeLogsDir = Environment.GetEnvironmentVariable("logs_directory") ?? ""; var internalTraceLogginDir = Path.Combine(gaugeProjectRoot, gaugeLogsDir); @@ -36,12 +37,11 @@ static async Task Main(string[] args) TraceLogger.Verbose($"{envVariableKey}: {envVariables[envVariableKey]}"); } - using (var host = CreateHostBuilder(args).Build()) - { - await host.StartAsync(); + using var host = CreateHostBuilder(args).Build(); - await host.WaitForShutdownAsync(ShutDownCancelationSource.Token); - } + await host.StartAsync(); + + await host.WaitForShutdownAsync(ShutDownCancellationSource.Token); } public static IHostBuilder CreateHostBuilder(string[] args) => diff --git a/src/ReportPortal.GaugePlugin/ReportPortal.GaugePlugin.csproj b/src/ReportPortal.GaugePlugin/ReportPortal.GaugePlugin.csproj index 9dc69c4..e934fd6 100644 --- a/src/ReportPortal.GaugePlugin/ReportPortal.GaugePlugin.csproj +++ b/src/ReportPortal.GaugePlugin/ReportPortal.GaugePlugin.csproj @@ -23,7 +23,7 @@ - + diff --git a/src/ReportPortal.GaugePlugin/Services/EmptyMessagesHandler.cs b/src/ReportPortal.GaugePlugin/Services/EmptyMessagesHandler.cs index 7ae9a2e..5729d21 100644 --- a/src/ReportPortal.GaugePlugin/Services/EmptyMessagesHandler.cs +++ b/src/ReportPortal.GaugePlugin/Services/EmptyMessagesHandler.cs @@ -74,7 +74,7 @@ public override Task Kill(KillProcessRequest request, ServerCallContext c } finally { - Program.ShutDownCancelationSource.Cancel(); + Program.ShutDownCancellationSource.Cancel(); } } } diff --git a/src/ReportPortal.GaugePlugin/Services/ReportMessagesHandler.cs b/src/ReportPortal.GaugePlugin/Services/ReportMessagesHandler.cs index 9dfc89a..88d9ad3 100644 --- a/src/ReportPortal.GaugePlugin/Services/ReportMessagesHandler.cs +++ b/src/ReportPortal.GaugePlugin/Services/ReportMessagesHandler.cs @@ -252,7 +252,7 @@ public override Task Kill(KillProcessRequest request, ServerCallContext c } finally { - Program.ShutDownCancelationSource.Cancel(); + Program.ShutDownCancellationSource.Cancel(); } } }