From 09cc838bb488847ef35c7427b182de469ebc27f2 Mon Sep 17 00:00:00 2001 From: Michael Bucari-Tovo Date: Thu, 18 Aug 2022 10:45:07 -0600 Subject: [PATCH] Checks --- Source/LibationFileManager/InteropFactory.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Source/LibationFileManager/InteropFactory.cs b/Source/LibationFileManager/InteropFactory.cs index ce674ae4..61fae68b 100644 --- a/Source/LibationFileManager/InteropFactory.cs +++ b/Source/LibationFileManager/InteropFactory.cs @@ -39,8 +39,6 @@ namespace LibationFileManager // searches file names for potential matches; doesn't run anything var configApp = getOSConfigApp(); -#if DEBUG - // nothing to load if (configApp is null) { @@ -48,6 +46,9 @@ namespace LibationFileManager return; } +#if DEBUG + + // runs the exe and gets the exe's loaded modules ModuleList = LoadModuleList(Path.GetFileNameWithoutExtension(configApp)) .OrderBy(x => x.ModuleName) @@ -56,7 +57,7 @@ namespace LibationFileManager AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; - var configAppAssembly = Assembly.LoadFrom(Path.ChangeExtension(configApp, "dll")); + var configAppAssembly = Assembly.LoadFrom(configApp); var type = typeof(IInteropFunctions); InteropFunctionsType = configAppAssembly .GetTypes() @@ -121,7 +122,7 @@ namespace LibationFileManager #if DEBUG // `First` instead of `FirstOrDefault`. If it's not present we're going to fail anyway. May as well be here - var modulePath = ModuleList.SingleOrDefault(m => m.ModuleName.EqualsInsensitive(asmName)).FileName; + var modulePath = ModuleList.SingleOrDefault(m => m.ModuleName.EqualsInsensitive(asmName))?.FileName; #else var here = Path.GetDirectoryName(Environment.ProcessPath);