-
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
[mono] Don't call Assembly.CodeBase directly in RuntimeAssembly.GetName #54895
Conversation
I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label. |
Tagging subscribers to this area: Issue DetailsIt's marked as not available in single file apps. Fixes #54835
|
@@ -252,7 +252,7 @@ private static void AddPublicNestedTypes(Type type, List<Type> types, List<Excep | |||
|
|||
public override AssemblyName GetName(bool copiedName) | |||
{ | |||
return AssemblyName.Create(_mono_assembly, CodeBase); | |||
return AssemblyName.Create(_mono_assembly, get_code_base (this, false)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this an actual fix? What does it return for single-file like targets?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Mono we have two names associated with an assembly. It's "filename" which corresponds to Assembly.Location
which is NULL for single-file targets like WebAssembly. And "name" which is derived from the name that the assembly was called in the bundle which is returned for Assembly.CodeBase
.
So yea this is the actual fix - the issue is that the CodeBase public getter is tagged as not available in single-file. But get_code_base
is not. And it returns a reasonable value. So we use it directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah and I don't think that's correct. The value is exposed via https://github.com/dotnet/runtime/blob/main/src/libraries/System.Private.CoreLib/src/System/Reflection/AssemblyName.cs#L63 which says that the values should be empty string (null value effectively)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Switched to using MonoImage:filename
which will be null for bundles
It's marked as not available in single file apps. Call the underlying get_code_base icall. Fixes dotnet#54835
For bundled asssemblies in single file scenarios, RuntimeAssembly.CodeBase will be null, matching CoreCLR.
Ok, so now wasm is failing a codebase test in
How does this test pass on CoreCLR single file? or is it skipped somehow? @eerhardt |
I don't believe the test is executed on CoreCLR single file. Honestly, I don't think any of our library tests are executed under CoreCLR single file. |
I believe that is controlled by the following switch -> https://github.com/dotnet/runtime/blob/main/src/libraries/tests.proj#L329 |
I believe there is a single-file like PlatformDetection property.
I think System.Reflection would be a very useful addition to the list. |
It's marked as not available in single file apps.
Call the underlying get_code_base icall.
Fixes #54835