natemcmaster / DotNetCorePlugins

.NET Core library for dynamically loading code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using the library in MacOs project

klioqc opened this issue · comments

commented

Hello,
I am trying to use this library in the project with
net6.0-macos
It fails with the error
Dependency resolution failed for component [...] with error code -2147450750. Detailed error: Hostpolicy must be initialized and corehost_main must have been called before calling corehost_resolve_component_dependencies
This happens on this call
_dependencyResolver = new AssemblyDependencyResolver(mainAssemblyPath);
here

I found a description for this problem in the Xamarin GitHub [System.Runtime.Loader.AssemblyDependencyResolver doesn't work in macOS(https://github.com/xamarin/xamarin-macios/issues/15685)
and they write they are not going to do anything.

Is there a way to avoid this class instantiation? I looked into AssemblyLoadContext config setting but it does not allow to avoid that resolver instantiation.