Skip to content
Discussion options

You must be logged in to vote

Here's a potential workaround:

_kernel = _kernel.Clone();
_kernel.Plugins.Clear();
_kernel.Plugins.AddFromType<EmailPlugin>("EmailPlugin", _kernel.Services);

The Plugins property is essentially a collection of KernelPlugin instances. The key is to explicitly pass the services when adding the plugin. By passing _kernel.Services as the second parameter, the plugin is instantiated using the services registered in the cloned kernel's DI container, enabling the EmailPlugin to properly resolve its IEmailService dependency.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by futugyou
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
.NET Issue or Pull requests regarding .NET code triage
2 participants