microsoft / microsoft/typespec

[http-client-csharp] Fix partial method customization parameter rebinding

Open
#11,245 1 comment 1 reaction 1 assignee Claimed by @ArcturusZhang View on GitHub
bug emitter:client:csharp
Dominant language
Java
Stars
5.9k
Forks
394
Avg merge
1d 23h
Merged PRs (30d)
104

Description

## Problem

C# partial method signature customization can generate invalid or uncompilable code in some paths.

Observed issues:

1. Method modifiers can be emitted in invalid order when the custom partial declaration includes `virtual`, e.g. `public partial virtual ...` instead of `public virtual partial ...`.
2. The generic late customization path can update the generated method signature with custom parameter names, while the already-built method body still references the old generated parameter names.
3. Async partial implementations need to preserve generated `async` because custom partial declarations cannot include `async` without a body.

## Expected behavior

When a generated method matches a custom partial method declaration:

- emitted modifiers should be valid C#;
- generated bodies should reference the final parameter names;
- async generated implementations should remain async;
- optional parameter metadata should continue to come from the custom partial declaration.

## Notes

This is separate from the broader parameter ownership cleanup tracked by #11244.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.