Closed rfriend-zilo closed 1 month ago
Rather than calling async code from sync code using .Result, inside ExecAsync just await action() then construct Func<RestClient, RestResponse> getResponse using the result from that awaited call.
can you please file a PR with the suggested fix when you've time?
My solution was not correct, my suggestion is to revert the changes in the PR.
@filipe-silva can you please review this issue reported by @rfriend-zilo when you've time?
@filipe-silva can you please review this issue reported by @rfriend-zilo when you've time?
This concern makes sense, I did a fix to resolve this issue. How do I merge it or include it in this PR?
@filipe-silva can you please file a new PR?
@rfriend-zilo can you please review the fix when you've time?
https://github.com/OpenAPITools/openapi-generator/pull/19231
Bug Report Checklist
Description
The direct call here to Task.Result is blocking the thread, and when used in a blazor application prevents UI from rendering :
https://github.com/OpenAPITools/openapi-generator/blob/9ae877598713eff7c6b1bbb53c5b3b8ed22fa1f2/modules/openapi-generator/src/main/resources/csharp/ApiClient.mustache#L628
Related issues/PRs
https://github.com/OpenAPITools/openapi-generator/pull/18915/files/0639c25fe8affd4c6ad8ea3d26711cc0f83a7bf1
Suggest a fix
Rather than calling async code from sync code using .Result, inside ExecAsync just await action() then construct Func<RestClient, RestResponse> getResponse using the result from that awaited call.