You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
.Net: Automatic conversion of enums is not working as expected #5045
Describe the bug
Automatic conversion of enums is not working as expected.
To Reproduce
Function has a default value provided for the pipelineType argument
Trying to invoke the function without pipelineType defined, but this doesn't work for the current GetConverter implementation. When I called the plugin again and provided a value for pipelineType, the EnumConverter was loaded and invoked just fine. Part of me feels like this code should be able to check if the argument is defined with a default value, and if it is trust the compiler and just return the converter instead of returning null and throwing the "Unable to find type converter" function.
Expected behavior
Update: ok, I discovered that by excluding the pipelineType argument from the KernelArguments entirely since the value being added was an empty string, that this worked. So I wonder if the logic should follow "if the input is empty, but the parameter has a default value, and there can be a converter for the parameter type, trust the compiler runtime"
Update #2: I just did a check and removed the default value from the function definition, when I tried to invoke it without a value, the Kernel successfully got angry with me "InvokePlugin Failed with an error. Missing argument for function parameter 'pipelineType'"
Activity
SergeyMenshykh commentedon Feb 23, 2024
The issue is caused by a try to set null to not nullable parameter with default value:
SK follows the C# function-calling semantic, which does not allow calling functions with null arguments for non-nullable parameters.
There are two ways to solve this issue, both of which are aligned with C# function-calling semantics:
Therefore, closing the issue for now.