diff --git a/src/Kiota.Builder/Refiners/CliRefiner.cs b/src/Kiota.Builder/Refiners/CliRefiner.cs index d8fe315c45..8db2891caa 100644 --- a/src/Kiota.Builder/Refiners/CliRefiner.cs +++ b/src/Kiota.Builder/Refiners/CliRefiner.cs @@ -404,15 +404,17 @@ private static CodeType CreateCommandType(CodeTypeBase.CodeTypeCollectionKind co } private static readonly AdditionalUsingEvaluator[] additionalUsingEvaluators = - { - new(x => x is CodeClass { Kind: CodeClassKind.RequestBuilder }, + [ + new(static x => x is CodeClass { Kind: CodeClassKind.RequestBuilder }, "System.CommandLine", "Command", "RootCommand", "IConsole"), - new(x => x is CodeClass { Kind: CodeClassKind.RequestBuilder }, + new(static x => x is CodeClass { Kind: CodeClassKind.RequestBuilder }, "Microsoft.Kiota.Cli.Commons.IO", "IOutputFormatter", "IOutputFormatterFactory", "FormatterType", "PageLinkData", "IPagingService"), - new(x => x is CodeClass { Kind: CodeClassKind.RequestBuilder }, + new(static x => x is CodeClass { Kind: CodeClassKind.RequestBuilder }, "System.Text", "Encoding"), - new(x => x is CodeMethod { Kind: CodeMethodKind.RequestExecutor or CodeMethodKind.RequestGenerator }, - "Microsoft.Kiota.Cli.Commons.Extensions", "GetRequestAdapter") - }; + new(static x => x is CodeClass { Kind: CodeClassKind.RequestBuilder }, + "System.Linq", "Enumerable"), + new(static x => x is CodeMethod { Kind: CodeMethodKind.RequestExecutor or CodeMethodKind.RequestGenerator }, + "Microsoft.Kiota.Cli.Commons.Extensions", "GetRequestAdapter"), + ]; } diff --git a/src/Kiota.Builder/Writers/CLI/CliCodeMethodWriter.cs b/src/Kiota.Builder/Writers/CLI/CliCodeMethodWriter.cs index da96ec88a5..5372d7a114 100644 --- a/src/Kiota.Builder/Writers/CLI/CliCodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/CLI/CliCodeMethodWriter.cs @@ -641,7 +641,7 @@ protected virtual void WriteCommandHandlerBody(CodeMethod codeElement, CodeClass if (requestBodyParamType?.TypeDefinition is CodeClass) { writer.WriteLine($"using var stream = new MemoryStream(Encoding.UTF8.GetBytes({requestBodyParam.Name}));"); - writer.WriteLine($"var parseNode = ParseNodeFactoryRegistry.DefaultInstance.GetRootParseNode(\"{generatorMethod.RequestBodyContentType.SanitizeDoubleQuote()}\", stream);"); + writer.WriteLine($"var parseNode = await ParseNodeFactoryRegistry.DefaultInstance.GetRootParseNodeAsync(\"{generatorMethod.RequestBodyContentType.SanitizeDoubleQuote()}\", stream, {CancellationTokenParamName});"); var typeString = conventions.GetTypeString(requestBodyParamType, requestBodyParam, false);