-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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 returns nonexistent path for assemblies from single-file #40087
Comments
Tagging subscribers to this area: @swaroop-sridhar, @agocke |
I don't know what the intent is for |
The original intent for these APIs was to return URL to use for Code Access Security checks. E.g. if the assembly was downloaded from internet, these APIs can return I do not have a strong opinion about what to do about these for single file. |
Returning empty string sounds most reasonable to me. |
In the single-file case, even corelib will likely be in the bundle and so have an empty string location, so empty string seems most consistent and simplest to understand. I also don't have strong feelings. |
From .NET Native experience: This API is similar to the For I would just go with throwing an exception with a message. We are obsoleting the APIs; no need to spend more energy on things like updating docs. |
Good point. Throwing from APIs like this makes diagnostic a lot easier. |
One complication: we've apparently doc'd the behavior when the assembly is loaded as a byte array:
Obviously in the bundle case every case would be loaded from a byte array, so this behavior isn't well specified, but I'm not sure how we would deal with this in the code. |
All of these APIs throw in 5.0 and 6.0 |
Assembly.CodeBase
Assembly.EscapedCodeBase
AssemblyName.CodeBase
AssemblyName.EscapedCodeBase
all these APIs when called on an assembly loaded from single file return nonexistent path - basically as if the assembly file lives next to the executable.
The question is what is the correct behavior:
Assembly.Location
CodeBase
/EscapedCodeBase
even thoughAssembly.Location
returns empty stringThe text was updated successfully, but these errors were encountered: