Skip to content

AssemblyDependencyResolver raises exception when hosting .NET using using Mscoree.h #39167

Closed
@cheverdyukv

Description

@cheverdyukv

Description

Creating instance of AssemblyDependencyResolver throws exception "Hostpolicy must be initialized and corehost_main must have been called before calling corehost_resolve_component_dependencies" when native host uses Mscoree.h to load .NET 5 runtime.

Steps:

  1. Create host using https://docs.microsoft.com/en-us/dotnet/core/tutorials/netcore-hosting#create-a-host-using-mscoreeh as example.
  2. Run managed code using CreateDelegate approach.
  3. In .NET code create instance of AssemblyDependencyResolver.

Expected behavior: I believe during host initialization I provided enough information to allow AssemblyDependencyResolver work
Actual behavior: Exception is raised in corehost_resolve_component_dependencies

Configuration

  • .NET preview 5, but I don't think there were any changes in preview 6.
  • Windows 10
  • Using x64 but I don't think it is specific to architecture

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions