Skip to content

Support Usage of Library in Non-Default AssemblyLoadContext(s) #110

@Sewer56

Description

@Sewer56

Context

Currently as-is, DotNetCorePlugins assumes that the library is always used from the domain of the default AssemblyLoadContext; this however may not always be the case.

Problem

There are cases where the library cannot be used from the default AssemblyLoadContext (without unreasonable workarounds), consider the following example scenarios:

  • The currently executing .NET Code was created or initially invoked from the native side.

In some interop scenarios where native code spawns managed code, the managed code will be spawned outside of the default AssemblyLoadContext. Consider for example Native Runtime
Docs: https://docs.microsoft.com/en-us/dotnet/core/tutorials/netcore-hosting

Although not mentioned in the article, at least two of the three methods listed there will lead to the loaded code to be executed outside of the default context. (I'm not sure about the remaining one)

  • The currently executing .NET Code is a plugin, which wishes to have its own plugin system too.

Simple enough. Plugins inside plugins. May sound too convoluted for most applications but I do see it as a possibility that will eventually happen and will be asked about someday.

Additional Note

I have already solved this problem, this is just a post to link to my pull request 😉.
Post could have been longer but I cut it down to the summary.

PR Incoming Soon (#111)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions