-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Closed
Labels
area-VM-reflection-monoReflection issues specific to MonoVMReflection issues specific to MonoVMruntime-monospecific to the Mono runtimespecific to the Mono runtime
Milestone
Description
CodeBase is marked as RequiresAssemblyFiles, which means that it can throw an exception if the application is published as a single-file application.
runtime/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimeAssembly.cs
Lines 253 to 256 in bde0322
| public override AssemblyName GetName(bool copiedName) | |
| { | |
| return AssemblyName.Create(_mono_assembly, CodeBase); | |
| } |
We should decide what to do here for Mono. In CoreCLR, we don't call CodeBase directly, but instead we call the underlying GetCodeBase() method, which returns null when running in a single-file application:
runtime/src/coreclr/System.Private.CoreLib/src/System/Reflection/RuntimeAssembly.cs
Lines 102 to 117 in bde0322
| // If the assembly is copied before it is loaded, the codebase will be set to the | |
| // actual file loaded if copiedName is true. If it is false, then the original code base | |
| // is returned. | |
| public override AssemblyName GetName(bool copiedName) | |
| { | |
| string? codeBase = GetCodeBase(); | |
| var an = new AssemblyName(GetSimpleName(), | |
| GetPublicKey(), | |
| null, // public key token | |
| GetVersion(), | |
| GetLocale(), | |
| GetHashAlgorithm(), | |
| AssemblyVersionCompatibility.SameMachine, | |
| codeBase, | |
| GetFlags() | AssemblyNameFlags.PublicKey); |
Maybe we should do the same?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-VM-reflection-monoReflection issues specific to MonoVMReflection issues specific to MonoVMruntime-monospecific to the Mono runtimespecific to the Mono runtime