Skip to content

Reconsider or clarify behavior around loading external images of assemblies in TRUSTED_PLATFORM_ASSEMBLIES. #124735

@teo-tsirpanis

Description

@teo-tsirpanis

As I discovered during my investigation of microsoft/MSBuildLocator#336, if an assembly is specified in TRUSTED_PLATFORM_ASSEMBLIES, the runtime does not allow loading a newer version of it, even in a separate ALC. This does make sense for assemblies in the shared framework, because not all of them are designed to be loaded multiple times, but TPA also includes user-specified dependencies, which caused the aforementioned issue, and can inhibit plugin dependency isolation.

Trying to load an assembly with an older or equal version will cause the runtime to ignore it and load the TPA assembly. However, contrary to what I would expect from the intent of this assembly unification, the same assembly will still be loaded once per ALC.

If this TPA assembly unification is desirable (which I believe it is), I believe that we should always load the TPA assemblies to the default ALC. I would also suggest to limit this behavior to assemblies in the shared framework (either in Microsoft.NetCore.App only, or in any of them). Regardless, we should update the managed assembly loading documentation, and make error messages more helpful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-AssemblyLoader-coreclrquestionAnswer questions and provide assistance, not an issue with source code or documentation.

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions