From 817252f6d191ab179c069d68ccfd172d137b714a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= Date: Sun, 31 Dec 2023 04:48:04 +0100 Subject: [PATCH] Use AppContext.BaseDirectory as default for AssemblyInjectorOptions.ModuleDirectory. --- src/injection/AssemblyInjectorOptions.cs | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/src/injection/AssemblyInjectorOptions.cs b/src/injection/AssemblyInjectorOptions.cs index 81165d8..fe9c5e0 100644 --- a/src/injection/AssemblyInjectorOptions.cs +++ b/src/injection/AssemblyInjectorOptions.cs @@ -6,27 +6,12 @@ public sealed class AssemblyInjectorOptions public ImmutableArray Arguments { get; private set; } = []; - public string ModuleDirectory { get; private set; } = _defaultDirectory; + public string ModuleDirectory { get; private set; } = AppContext.BaseDirectory; public TimeSpan InjectionTimeout { get; private set; } = Timeout.InfiniteTimeSpan; public TimeSpan CompletionTimeout { get; private set; } = Timeout.InfiniteTimeSpan; - private static readonly string _defaultDirectory; - - [SuppressMessage("", "CA1810")] - [UnconditionalSuppressMessage("", "IL3000")] - static AssemblyInjectorOptions() - { - // TODO: https://github.com/dotnet/Nerdbank.GitVersioning/issues/555 -#pragma warning disable CS0436 - var location = typeof(ThisAssembly).Assembly.Location; -#pragma warning restore CS0436 - - _defaultDirectory = Path.GetDirectoryName(location.Length != 0 ? location : Environment.ProcessPath) ?? - Environment.CurrentDirectory; - } - private AssemblyInjectorOptions() { }