Skip to content

NativeMethods - Wrong originalAssemblypath #202

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Danielku15 opened this issue Aug 15, 2012 · 1 comment
Closed

NativeMethods - Wrong originalAssemblypath #202

Danielku15 opened this issue Aug 15, 2012 · 1 comment
Milestone

Comments

@Danielku15
Copy link

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
Copy link
Member

Wow. Very cool bug report!

The fix has been merged in vNext.

Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants