diff --git a/src/IKVM.Runtime/LibIkvm.cs b/src/IKVM.Runtime/LibIkvm.cs index 5ceb9cabb..4235c8b54 100644 --- a/src/IKVM.Runtime/LibIkvm.cs +++ b/src/IKVM.Runtime/LibIkvm.cs @@ -218,7 +218,7 @@ static nint Load() return h1; // start looking at assembly path, or path given by environmental variable - var asml = typeof(NativeLibrary).Assembly.Location is string s ? Path.GetDirectoryName(s) : null; + var asml = typeof(NativeLibrary).Assembly.Location is string s && !string.IsNullOrEmpty(s) ? Path.GetDirectoryName(s) : null; var root = Environment.GetEnvironmentVariable("IKVM_LIBRARY_PATH") ?? asml ?? AppContext.BaseDirectory; // assembly possible loaded in memory: we have no available search path diff --git a/src/IKVM.Runtime/NativeLibrary.cs b/src/IKVM.Runtime/NativeLibrary.cs index 28f02a7bb..a96054309 100644 --- a/src/IKVM.Runtime/NativeLibrary.cs +++ b/src/IKVM.Runtime/NativeLibrary.cs @@ -73,7 +73,7 @@ public static NativeLibraryHandle Load(string nameOrPath) return h1; // start looking at assembly path, or path given by environmental variable - var asml = typeof(NativeLibrary).Assembly.Location is string s ? Path.GetDirectoryName(s) : null; + var asml = typeof(NativeLibrary).Assembly.Location is string s && !string.IsNullOrEmpty(s) ? Path.GetDirectoryName(s) : null; var root = Environment.GetEnvironmentVariable("IKVM_LIBRARY_PATH") ?? asml; // assembly possible loaded in memory: we have no available search path