-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Assembly.CodeBase does not produce a correctly escaped URI #38224
Comments
I couldn't figure out the best area label to add to this issue. Please help me learn by adding exactly one area label. |
Doesn't appear to be an issue with I tried: var u = new Uri("C:/Users/asoni/source/repos/Demo#App/DemoApp/bin/Debug/netcoreapp3.1/IBM.Data.DB2.Core.dll");
Console.WriteLine(u);
Console.WriteLine(u.LocalPath); Which outputs:
|
Tagging subscribers to this area: @dotnet/ncl |
@marcpopMSFT did you mean to self-assign this one? |
@scalablecory it was assigned to me in the sdk repo for triage and I forgot to unassign when transferring over |
@scalablecory here is repro:
Output:
|
Uri will parse the # in Uri will correctly escape the # when you retrieve the absolute Uri: So I would argue that the problem here is not with Uri, but
|
This was changed from a |
Hi,
We have a customer case where their Application path contains '#'.
For example path is:
C:/Users/asoni/source/repos/Demo#App/DemoApp
and we get path for IBM.Data.DB2.Core.dll using below code:
typeof(DB2Connection).Assembly.CodeBase
Output is:
file:///C:/Users/asoni/source/repos/Demo#App/DemoApp/bin/Debug/netcoreapp3.1/IBM.Data.DB2.Core.dll
Now we use Uri class to get physical path:
string assemLoc = (new Uri(typeof(DB2Connection).Assembly.CodeBase)).LocalPath;
Output is:
C:\Users\asoni\source\repos\Demo
Expected output:
C:/Users/asoni/source/repos/Demo#App/DemoApp/bin/Debug/netcoreapp3.1/IBM.Data.DB2.Core.dll
If we don't have # in Application path it works perfectly fine..
Could you share what is the reason behind this behavior and How come we can overcome this issue if we want to allow # in path ?
The text was updated successfully, but these errors were encountered: