When doing remote debugging. I share the directory say "d:\debug\app" on my remote debug machine to host machine.
On my host machine I setup the debug setting to use remote machine: "user@machine" and start external program "\\machine\debug\app\start.exe"
When following program runs:
string codeBase = Assembly.GetExecutingAssembly().CodeBase;//codeBase="file://machine/debug/app/lib.dll"
UriBuilder uri = new UriBuilder(codeBase);
string path = Uri.UnescapeDataString(uri.Path);
Directory.SetCurrentDirectory(Path.GetDirectoryName(path));//Path.GetDirectoryName(path)="\\debug\\app"
getting error:
System.IO.DirectoryNotFoundException was unhandled
Message="Could not find a part of the path '\\\\machine\\debug\\debug\\app'."
Looks like the Directory.SetCurrentDirectory() is taking the shared folder as root. and trying to do "\machine\debug" + "debug\app"
How to fix this?
It's not a problem of formate. There is a similar question here: How do I convert a UNC path back to an absolute local path on the remote PC?
But, the author give a self code solution. I would like something easy with existing API and tools.