NativeMethods - Wrong originalAssemblypath #202

Danielku15 opened this Issue Aug 15, 2012 · 1 comment


None yet

2 participants


Your method of determining the assembly path is not working all the time. An example is: If you have a # sign in your path, it will get stripped off by the Uri:

string codeBase = Assembly.GetExecutingAssembly().CodeBase; // "file://D:/Dev/C#/Projects/../../Test.exe"
string originalAssemblypath = new Uri(codeBase).LocalPath; // "D:\Dev\C"

You should use this method of getting the location:

string originalAssemblypath = new FileInfo(Assembly.GetExecutingAssembly().Location).DirectoryName

The location attribute stores a more system friendly path to the running executable.

@nulltoken nulltoken added a commit to nulltoken/libgit2sharp that referenced this issue Aug 15, 2012
@nulltoken nulltoken Fix detection of the path to the native libraries
Fix #202

Prevent the path from being truncated when it contains a hash (#).
libgit2 member

Wow. Very cool bug report!

The fix has been merged in vNext.


@nulltoken nulltoken closed this Aug 15, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment