z4kn4fein / stashbox

A lightweight, fast, and portable dependency injection framework for .NET-based solutions.

Home Page:https://z4kn4fein.github.io/stashbox

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to resolve Orleans.Runtime.IKeyedServiceCollection`2[System.Type,Orleans.Runtime.Placement.IPlacementDirector]

dmitrig89 opened this issue · comments

When adding StashBox to a project using Microsoft Orleans, the host is unable to resolve the following type:

Orleans.Runtime.IKeyedServiceCollection`2[System.Type,Orleans.Runtime.Placement.IPlacementDirector]

The following versions were used to when encountering this issue:

Microsoft.Extensions.Hosting Version=7.0.1
Microsoft.Orleans.Server Version=7.1.1
Stashbox.Extensions.Hosting Version=4.6.0

The simplest reproduction of this issue can be seen in the following example:

using Microsoft.Extensions.Hosting;

await Host.CreateDefaultBuilder(args)
    .UseOrleans(siloBuilder =>
    {
        siloBuilder.UseLocalhostClustering();
    })
    .RunConsoleAsync();

This code runs fine and starts up an instance of an Orleans Silo on a localhost.

When adding stashbox, the as seen below, the following error is produced:

using Microsoft.Extensions.Hosting;

await Host.CreateDefaultBuilder(args)
    .UseStashbox()
    .UseOrleans(siloBuilder =>
    {
        siloBuilder.UseLocalhostClustering(); ;
    })
    .RunConsoleAsync();

 System.InvalidOperationException: No service for type 'Orleans.Runtime.IKeyedServiceCollection`2[System.Type,Orleans.Runtime.Placement.IPlacementDirector]' has been registered.

Hi @dmitrig89, thank you for reporting this!
I've found the root cause and fixed it in Stashbox v5.8.1. I've also published a new Stashbox.Extensions.Hosting package with the version v4.6.1.
Let me know if you have further issues!

Amazing!!!

Thanks @z4kn4fein.

I can confirm this no longer happens on v5.8.1

Very quick work, much appreciated.