semantic-kernel
semantic-kernel copied to clipboard
Disposing skills
Motivation and Context
This change is required to fix a memory leak related to not disposed resource used by Skills. The issue may manifest itself any time skills that work with managed and unmanaged resources like files, network, etc... are registered in Kernel and the Kernel is disposed but the Skills aren't.
Description
This PR adds functionality that disposes all Skills registered in Kernel when Kernel.Dispose method is called.
Contribution Checklist
- [x] The code builds clean without any errors or warnings
- [x] The PR follows SK Contribution Guidelines (https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
- [x] The code follows the .NET coding conventions (https://learn.microsoft.com/dotnet/csharp/fundamentals/coding-style/coding-conventions) verified with
dotnet format - [x] All unit tests pass, and I have added new tests where possible
- [x] I didn't break anyone :smile: