PrismLibrary / Prism

Prism is a framework for building loosely coupled, maintainable, and testable XAML applications in WPF, Xamarin Forms, and Uno / Win UI Applications..

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Feature Request] Add support Keyed Service for IServiceCollection

wangkewei111 opened this issue · comments

Description

Microsoft.Extension.DependencyInjection has new feature: Keyed Service from 8.0.0.
But it is not supported in IServiceProviderExtensions.RegisterTypesWithPrismContainer .
Then it throw exception :" Your service provider may not support keyed services "
I suggest add some code if "service.IsKeyedService".

Steps to Reproduce

containerRegistry.RegisterServices(collection => collection.AddKeyedSingleton())

Platform with bug

WPF

Affected platforms

Windows

Did you find any workaround?

No response

Relevant log output

No response

I ran into the same issue today. We updated the package Microsoft.Extensions.Http.Resilience from v8.1.0 to v8.2.0 and suddenly the application crashed at startup with 'This service descriptor is keyed. Your service provider may not support keyed services.'

If you are a Commercial Plus user this is now available starting with Prism.Container.DryIoc 9.0.92 or later.
Prism.Container.Microsoft already supports this.