Skip to content

Commit 034bdcc

Browse files
committed
fix the issue
1 parent 658553b commit 034bdcc

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

packages/http-client-csharp/generator/Microsoft.Generator.CSharp.ClientModel/src/Providers/ScmMethodProviderCollection.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public class ScmMethodProviderCollection : MethodProviderCollection
2323
{
2424
private string _cleanOperationName;
2525
private readonly MethodProvider _createRequestMethod;
26+
private static readonly ClientPipelineExtensionsDefinition _clientPipelineExtensionsDefinition = new();
2627

2728
private ClientProvider Client { get; }
2829

@@ -432,7 +433,7 @@ private ScmMethodProvider BuildProtocolMethod(MethodProvider createRequestMethod
432433
MethodBodyStatement[] methodBody =
433434
[
434435
UsingDeclare("message", ClientModelPlugin.Instance.TypeFactory.HttpMessageApi.HttpMessageType, This.Invoke(createRequestMethod.Signature, [.. requiredParameters, ..optionalParameters, requestOptionsParameter]), out var message),
435-
Return(ClientModelPlugin.Instance.TypeFactory.ClientResponseApi.ToExpression().FromResponse(client.PipelineProperty.Invoke(processMessageName, [message, requestOptionsParameter], isAsync, true))),
436+
Return(ClientModelPlugin.Instance.TypeFactory.ClientResponseApi.ToExpression().FromResponse(client.PipelineProperty.Invoke(processMessageName, [message, requestOptionsParameter], isAsync, true, extensionType: _clientPipelineExtensionsDefinition.Type))),
436437
];
437438

438439
var protocolMethod =

packages/http-client-csharp/generator/Microsoft.Generator.CSharp/src/Snippets/Snippet.cs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,28 +120,33 @@ public static InvokeMethodExpression Invoke(this ParameterProvider parameter, st
120120
public static ValueExpression Property(this ParameterProvider parameter, string propertyName, bool nullConditional = false)
121121
=> new MemberExpression(nullConditional ? new NullConditionalExpression(parameter) : parameter, propertyName);
122122

123-
public static InvokeMethodExpression Invoke(this FieldProvider field, string methodName, IEnumerable<ValueExpression> parameters)
124-
=> field.Invoke(methodName, parameters, false, false);
123+
public static InvokeMethodExpression Invoke(this FieldProvider field, string methodName, IEnumerable<ValueExpression> parameters, CSharpType? extensionType = null)
124+
=> field.Invoke(methodName, parameters, false, false, extensionType: extensionType);
125125

126126
public static InvokeMethodExpression Invoke(this FieldProvider field,
127127
string methodName,
128128
IEnumerable<ValueExpression> parameters,
129129
bool isAsync,
130-
bool configureAwait)
130+
bool configureAwait,
131+
CSharpType? extensionType = null)
131132
=> new InvokeMethodExpression(field, methodName, [.. parameters])
132133
{
133-
CallAsAsync = isAsync, AddConfigureAwaitFalse = configureAwait
134+
CallAsAsync = isAsync,
135+
AddConfigureAwaitFalse = configureAwait,
136+
ExtensionType = extensionType
134137
};
135138

136139
public static ValueExpression Invoke(this PropertyProvider property,
137140
string methodName,
138141
IEnumerable<ValueExpression> parameters,
139142
bool isAsync,
140-
bool configureAwait)
143+
bool configureAwait,
144+
CSharpType? extensionType = null)
141145
=> new InvokeMethodExpression(property, methodName, [.. parameters])
142146
{
143147
CallAsAsync = isAsync,
144-
AddConfigureAwaitFalse = configureAwait
148+
AddConfigureAwaitFalse = configureAwait,
149+
ExtensionType = extensionType
145150
};
146151

147152
public static ScopedApi<bool> NotEqual(this ParameterProvider parameter, ValueExpression other)

0 commit comments

Comments
 (0)