-
Notifications
You must be signed in to change notification settings - Fork 224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect parameter ordering for CancellationToken in generated RequestBuilder code #4692
Comments
Thanks for raising this @johnholliday Is this occurring on all methods or just a specific generated method? Are you able to share a sample of the description that replicates this scenario? |
@andrueastman Only on DeleteAsync and GetAsync. Sample project attached. |
Authored #4700 to resolve |
There is still a minor problem that causes CS8625 warnings on code like the following: #nullable enable
public async Task<UntypedNode?> DeleteAsync(Action<RequestConfiguration<DefaultQueryParameters>>? requestConfiguration = default, CancellationToken cancellationToken = default)
{
#nullable restore
#else
public async Task<UntypedNode> DeleteAsync(Action<RequestConfiguration<DefaultQueryParameters>> requestConfiguration = default, CancellationToken cancellationToken = default)
{
#endif
var requestInfo = ToDeleteRequestInformation(requestConfiguration);
return await RequestAdapter.SendAsync<UntypedNode>(requestInfo, /* CS8625 ==> */default, null, cancellationToken).ConfigureAwait(false);
}
Without delving further to determine if this manual fixup causes other issues, the warning goes away when patched as follows: return await RequestAdapter.SendAsync<UntypedNode>(requestInfo, default!, null, cancellationToken).ConfigureAwait(false); However, in my opinion, the generated code should compile without warnings and should not require manual fixups. |
Thanks for the feedback @johnholliday following up via #4727 |
What are you generating using Kiota, clients or plugins?
API Client/SDK
In what context or format are you using Kiota?
Windows executable
Client library/SDK language
Csharp
Describe the bug
The generated API client code fails to compile with the following error:
Expected behavior
The generated code should compile without errors. Specifically, the 'cancellationToken' parameter should be preceded by 'null', as in:
How to reproduce
Open API description file
No response
Kiota Version
1.14.0
Latest Kiota version known to work for scenario above?(Not required)
No response
Known Workarounds
Manually edit the generated code.
Configuration
Windows 11 x64
Debug output
Click to expand log
```The text was updated successfully, but these errors were encountered: