-
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
AssemblyLoadContext incorrectly validates name of dynamic assembly when returned from Load #53181
Comments
Tagging subscribers to this area: @vitek-karas, @agocke, @CoffeeFlux, @VSadov Issue Details
This is the cause because runtime/src/libraries/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyLoadContext.cs Line 660 in 01c9cf6
But this doesn't work for assemblies created by The code should call Full repro for both affected public APIs ( This is basically a derivative issue from the bug fix in #49387.
|
@vitek-karas runtime/src/coreclr/vm/appdomain.cpp Line 5416 in cc8d9b3
If I understood everything correctly, then the dynamic assembly is not domain-specific and the code execution goes along the specified branch with the subsequent generation of an exception. If fixing the definition of ALC for a dynamic assembly is not urgent, then I can investigate the above problem in more detail within the framework of this task. Otherwise, I propose to create a separate ticket for the error in the definition of ALC, merge it, merge the fixes of the tests (#48579) and then tackle the problem of this ticket tightly. |
Honestly I was expecting this - that dynamic assemblies will be prevented from actually succeeding in The potential support for dynamic assemblies in load resolution is probably a much larger work item (I'm not even sure what are all the potential problems with it for example), so I would definitely track that separately. There's also the question if it's actually worth going after at all. |
Okay, I fill in both fixes, but without the |
…ynamic assembly when returned from Load
AssemblyLoadContext
validates that the assembly returned fromLoad
has the same name as the name which was asked for. This validation incorrectly handles dynamic assemblies and will always fail for them.This is the cause because
ValidateAssemblyNameWithSimpleName
simply casts the returned assembly toRuntimeAssembly
:runtime/src/libraries/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyLoadContext.cs
Line 660 in 01c9cf6
But this doesn't work for assemblies created by
AssemblyBuilder
.The code should call
GetRuntimeAssembly
instead, which handles this case correctly.Full repro for both affected public APIs (
Load
andResolving
) is here:https://gist.github.com/vitek-karas/3c8f938dc15730ad00a375d8d745f36a
This is basically a derivative issue from the bug fix in #49387.
The text was updated successfully, but these errors were encountered: