[mono] Don't call Assembly.CodeBase directly in RuntimeAssembly.GetName#54895
[mono] Don't call Assembly.CodeBase directly in RuntimeAssembly.GetName#54895lambdageek merged 4 commits intodotnet:mainfrom
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
|
There was a problem hiding this comment.
Is this an actual fix? What does it return for single-file like targets?
There was a problem hiding this comment.
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.
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.
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