Skip to content

bug: Handle function name duplicates when using TAP#20

Merged
lsiddiquee merged 4 commits intomainfrom
feature/16-support-overloaded-methods-for-clr-types
Jul 8, 2025
Merged

bug: Handle function name duplicates when using TAP#20
lsiddiquee merged 4 commits intomainfrom
feature/16-support-overloaded-methods-for-clr-types

Conversation

@lsiddiquee
Copy link
Owner

@lsiddiquee lsiddiquee commented Jul 8, 2025

This PR addresses the issue where function name duplicates were not handled when using the Task-based Asynchronous Pattern (TAP) in CLR type plugins. 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.

The plugin builder now filters out these duplicates by normalizing the functions by removing the cancellation token parameter and async suffix then choosing the one with the CancellationToken parameter if available or the one with async suffix in the order.

Also sample have been updated to use Random, which showcases how to handle function overload and azure queue client sdk where the tap function name duplicate happens.

Closes #16

@lsiddiquee lsiddiquee merged commit 8f369e2 into main Jul 8, 2025
2 checks passed
@lsiddiquee lsiddiquee deleted the feature/16-support-overloaded-methods-for-clr-types branch July 8, 2025 10:03
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.

Add support for both async and non-async method implementations in CLR types

1 participant

Comments