[http-client-csharp] Emit async modifier when customizing an async method via a partial method (CS4032)#11222
Merged
Conversation
Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix async modifier omission in partial method customization
[http-client-csharp] Emit Jul 9, 2026
async modifier when customizing an async method via a partial method (CS4032)
commit: |
Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com>
jorgerangel-msft
marked this pull request as ready for review
July 10, 2026 15:04
jorgerangel-msft
requested review from
JoshLove-msft,
ShivangiReja,
joseharriaga,
jsquire and
m-nash
as code owners
July 10, 2026 15:04
jorgerangel-msft
enabled auto-merge
July 10, 2026 15:05
jsquire
approved these changes
Jul 10, 2026
JoshLove-msft
approved these changes
Jul 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Customizing an async client method via a C#
partialmethod declaration produced an implementing declaration without theasyncmodifier, while the generated body usesawait— resulting in compiler error CS4032.A partial declaration cannot carry
async(that modifier belongs to the implementing declaration), so building the implementation signature from the customer's declaration modifiers dropped it. The generated (non-custom) path addsAsyncseparately, so only the custom-code path was affected.Changes
PartialMethodCustomization.BuildPartialSignature: added an optionaladditionalModifiersparameter, OR-ed into the resulting signature modifiers. Backward-compatible and reusable by downstream emitters.ScmMethodProviderCollection: both custom-code call sites (BuildProtocolMethod,BuildConvenienceMethod) now passMethodSignatureModifiers.AsyncwhenisAsync && _pagingServiceMethod == null, mirroring the condition already used by the generated path.CanCustomizeAsyncMethodSignatureand its custom-code test data asserting theAsyncmodifier is present on the customized async protocol method.Result
Given a custom partial declaration:
the generated implementation now emits: