Skip to content
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

Fix log return disposed obj #705

Merged
merged 3 commits into from
Sep 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gen/KubernetesGenerator/Kubernetes.cs.template
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ namespace k8s
}
throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
}
{{/IfReturnType operation "stream"}}
{{/IfReturnType operation "obj"}}
}
{{/IfReturnType operation "any"}}
if (_shouldTrace)
Expand Down
22 changes: 22 additions & 0 deletions gen/KubernetesGenerator/KubernetesExtensions.cs.template
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,17 @@ namespace k8s
{{/operation.parameters}}
CancellationToken cancellationToken = default(CancellationToken))
{
{{#IfReturnType operation "stream"}}
var _result = await operations.{{GetMethodName operation "WithHttpMessagesAsync"}}(
{{#operation.parameters}}
{{GetDotNetName .}},
{{/operation.parameters}}
null,
cancellationToken);
_result.Request.Dispose();
{{GetReturnType operation "_result.Body"}};
{{/IfReturnType operation "stream"}}
{{#IfReturnType operation "obj"}}
using (var _result = await operations.{{GetMethodName operation "WithHttpMessagesAsync"}}(
{{#operation.parameters}}
{{GetDotNetName .}},
Expand All @@ -73,6 +84,17 @@ namespace k8s
{
{{GetReturnType operation "_result.Body"}};
}
{{/IfReturnType operation "obj"}}
{{#IfReturnType operation "void"}}
using (var _result = await operations.{{GetMethodName operation "WithHttpMessagesAsync"}}(
{{#operation.parameters}}
{{GetDotNetName .}},
{{/operation.parameters}}
null,
cancellationToken).ConfigureAwait(false))
{
}
{{/IfReturnType operation "void"}}
}

{{/.}}
Expand Down
2 changes: 1 addition & 1 deletion gen/KubernetesGenerator/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,7 @@ private static string GetApiVersion(JsonSchema4 definition)
{
fn(null);
}
else if (type == "stream" && rt == "Stream")
else if (type.ToLower() == rt.ToLower())
{
fn(null);
}
Expand Down
Loading