Skip to content

[WIP] Support overloaded methods for CLR types#19

Closed
Copilot wants to merge 1 commit intomainfrom
copilot/fix-eb604528-a615-4486-93d0-f2f391783dae
Closed

[WIP] Support overloaded methods for CLR types#19
Copilot wants to merge 1 commit intomainfrom
copilot/fix-eb604528-a615-4486-93d0-f2f391783dae

Conversation

Copy link

Copilot AI commented Jul 8, 2025

Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.

Original description:

Problem

As described in issue #16, Semantic Kernel currently throws errors when registering CLR types that have both async and non-async method implementations. This happens in two specific scenarios:

  1. When a type contains both an async method and a non-async method where the only difference is the 'Async' suffix (e.g., GetData() and GetDataAsync()). Semantic Kernel removes the 'Async' suffix during registration, causing a duplicate method error.

  2. When methods differ only by having a CancellationToken parameter (e.g., GetData() and GetData(CancellationToken)). Semantic Kernel removes the CancellationToken parameter in the KernelFunctionMetadata, again resulting in duplicate method errors.

Task

Modify the plugin to properly handle both async and non-async implementations of methods in CLR types without throwing errors. The solution should:

  1. Correctly differentiate between methods with and without 'Async' suffix
  2. Properly handle CancellationToken parameters in method signatures to avoid collisions
  3. Ensure that both async and non-async versions of the same method can be registered simultaneously

This PR will close issue #16.

This pull request was created as a result of the following prompt from Copilot chat.

Problem

As described in issue #16, Semantic Kernel currently throws errors when registering CLR types that have both async and non-async method implementations. This happens in two specific scenarios:

  1. When a type contains both an async method and a non-async method where the only difference is the 'Async' suffix (e.g., GetData() and GetDataAsync()). Semantic Kernel removes the 'Async' suffix during registration, causing a duplicate method error.

  2. When methods differ only by having a CancellationToken parameter (e.g., GetData() and GetData(CancellationToken)). Semantic Kernel removes the CancellationToken parameter in the KernelFunctionMetadata, again resulting in duplicate method errors.

Task

Modify the plugin to properly handle both async and non-async implementations of methods in CLR types without throwing errors. The solution should:

  1. Correctly differentiate between methods with and without 'Async' suffix
  2. Properly handle CancellationToken parameters in method signatures to avoid collisions
  3. Ensure that both async and non-async versions of the same method can be registered simultaneously

This PR will close issue #16.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI requested a review from lsiddiquee July 8, 2025 09:54
@lsiddiquee lsiddiquee closed this Jul 8, 2025
@lsiddiquee lsiddiquee deleted the copilot/fix-eb604528-a615-4486-93d0-f2f391783dae branch July 8, 2025 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments