-
Notifications
You must be signed in to change notification settings - Fork 5k
[Azure Mgmt Generator] Fix method ordering to put async methods first across all providers #51835
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
Conversation
… come first Co-authored-by: ArcturusZhang <[email protected]>
...ent-csharp-mgmt/generator/Azure.Generator.Management/src/Providers/ResourceClientProvider.cs
Show resolved
Hide resolved
…esourceProvider - async methods now come first Co-authored-by: ArcturusZhang <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes method ordering in the Azure Management Generator to ensure async methods appear before sync methods across all providers, matching the behavior of the old generator. Previously, the new generator was outputting sync methods first followed by async methods, which created unnecessary diffs when migrating from the old to new generator.
- Fixed method ordering in ResourceClientProvider for paging, update, and other resource operations
- Fixed method ordering in MockableResourceProvider for non-resource and get methods
- Ensures async methods consistently appear before sync methods across all generated code
Reviewed Changes
Copilot reviewed 2 out of 10 changed files in this pull request and generated no comments.
File | Description |
---|---|
ResourceClientProvider.cs | Reordered method generation to put async methods before sync methods for paging operations, update operations, and other resource operations |
MockableResourceProvider.cs | Reordered method generation to put async methods before sync methods for non-resource methods and get methods |
/check-enforcer override |
This PR fixes the method ordering in the Azure Management Generator to match the behavior of the old generator. Previously, the new generator was outputting sync methods first followed by async methods, but the old generator put async methods first.
Problem
The current generator produces code like this:
But the old generator produced:
Solution
Updated method ordering to generate async methods before sync methods across all providers:
ResourceClientProvider: Fixed ordering in three locations:
(sync, async)
to(async, sync)
(sync, async)
to(async, sync)
(sync, async)
to(async, sync)
MockableResourceProvider: Fixed ordering in two locations:
ResourceCollectionClientProvider: Already correct - uses
{ true, false }
pattern consistently.Verification
Generated test projects now show async methods appearing first in all resource classes, collection classes, and mockable providers. All 51 existing tests continue to pass. Generated code compiles successfully with no functional changes, only ordering changes.
This change reduces the code diff when switching from the old generator to the new generator, making the migration smoother.
Fixes #51834.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.