Skip to content

Commit

Permalink
on the CI, Assembly.Location doesn't seem to work (to investigate)
Browse files Browse the repository at this point in the history
  • Loading branch information
viogroza committed Sep 2, 2024
1 parent bdbceca commit 7b5ebe8
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,23 @@ public static void SNILoadWorkaround(bool isWindows = true)
if(!isWindows)
return;

//viorel -> to remove (check what are the paths on CI)
var codeBase = typeof(DbWorkarounds).Assembly.CodeBase;
var oldPath = Path.GetFullPath((typeof(DbWorkarounds).Assembly.CodeBase.Replace("file:///", "")) + RelativePath);

//IntPtr Handle = LoadLibrary();

var asmLocation = typeof(DbWorkarounds).Assembly.Location;
var path = Path.GetFullPath(asmLocation + RelativePath);
IntPtr Handle = LoadLibrary(path);
if (Handle == IntPtr.Zero)
{
int errorCode = Marshal.GetLastWin32Error();
string errorMessage = string.Format("Failed to load library {0} (ErrorCode: {1})",
path, errorCode);
//string errorMessage = string.Format("Failed to load library {0} (ErrorCode: {1})",
//path, errorCode);

string errorMessage = string.Format("Failed to load library {0} (ErrorCode: {1}) \n codeBase {2}, \n oldPath {3} \n is equal {4}",
path, errorCode, codeBase, oldPath, oldPath == path);
throw new Exception(errorMessage);
}
}
Expand Down

0 comments on commit 7b5ebe8

Please sign in to comment.