-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Make Azure.ResourceManager AOT-compatible #50129
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
|
Thank you for your contribution @agocke! We will review the pull request and get back to you soon. |
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 updates Azure.ResourceManager to be AOT-compatible by replacing non-source generated JSON with source-generated contexts and marking incompatible configuration bindings.
- Added attributes in ArmClientBuilderExtensions to flag reflection and dynamic code usage.
- Introduced new JSON context classes and updated serialization/deserialization calls to use them.
- Updated the project file and ArmClientOptions to support AOT compatibility.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| sdk/resourcemanager/Azure.ResourceManager/src/Extensions/ArmClientBuilderExtensions.cs | Added AOT-related attributes to the AddArmClient method. |
| sdk/resourcemanager/Azure.ResourceManager/src/Common/Custom/Models/ManagedServiceIdentityJsonContext.cs | Added a new JSON source generation context. |
| sdk/resourcemanager/Azure.ResourceManager/src/Common/Custom/Models/ManagedServiceIdentity.Serialization.cs | Updated JSON serialization/deserialization to use the new context. |
| sdk/resourcemanager/Azure.ResourceManager/src/Azure.ResourceManager.csproj | Added AOT compatibility property. |
| sdk/resourcemanager/Azure.ResourceManager/src/ArmEnvironmentJsonContext.cs | Introduced a context for ArmEnvironment JSON serialization. |
| sdk/resourcemanager/Azure.ResourceManager/src/ArmEnvironment.cs | Updated ToString to utilize the source-generated context. |
| sdk/resourcemanager/Azure.ResourceManager/src/ArmClientOptionsJsonContext.cs | Added a JSON context for ArmClientOptions. |
| sdk/resourcemanager/Azure.ResourceManager/src/ArmClientOptions.cs | Migrated deserialization to use the new JSON context. |
|
@m-nash: Could you give this another pair of eyes from the management + MRW perspective? |
|
FYI, still trying to repro those code generation failures locally. For some reason restore is taking forever |
jsquire
left a comment
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.
LGTM, though I lack in-depth knowledge of the management packages. I've pulled a couple of others in for additional perspectives.
|
@agocke: The failures are:
|
|
I've fixed up all the formatting and added the attribute, so I think this is ready to go. |
m-redding
left a comment
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.
This LGTM from my perspective although I also don't have much knowledge on the mgmt packages
sdk/resourcemanager/Azure.ResourceManager/src/Extensions/ArmClientBuilderExtensions.cs
Outdated
Show resolved
Hide resolved
|
@ArthurMa1978, @ArcturusZhang, @live1206, @m-nash: Folks, can you please give this a quick look from the management ownership perspective? Since everything is green, I'm going to move forward with the merge tomorrow EOD if nobody registers any objections or questions. |
|
I think we want to switch this to SCM SG to stay in line with the other core libraries. Spoke with @agocke today offline and we will come up with a overarching plan to fix the cross library JsonSerializer calls |
sdk/resourcemanager/Azure.ResourceManager/src/Extensions/ArmClientBuilderExtensions.cs
Outdated
Show resolved
Hide resolved
...emanager/Azure.ResourceManager/src/Common/Custom/Models/ManagedServiceIdentityJsonContext.cs
Outdated
Show resolved
Hide resolved
...nager/Azure.ResourceManager/src/Common/Custom/Models/ManagedServiceIdentity.Serialization.cs
Outdated
Show resolved
Hide resolved
...nager/Azure.ResourceManager/src/Common/Custom/Models/ManagedServiceIdentity.Serialization.cs
Outdated
Show resolved
Hide resolved
...nager/Azure.ResourceManager/src/Common/Custom/Models/ManagedServiceIdentity.Serialization.cs
Outdated
Show resolved
Hide resolved
...nager/Azure.ResourceManager/src/Common/Custom/Models/ManagedServiceIdentity.Serialization.cs
Outdated
Show resolved
Hide resolved
2327bcb to
3a6a52d
Compare
sdk/resourcemanager/Azure.ResourceManager/api/Azure.ResourceManager.net8.0.cs
Outdated
Show resolved
Hide resolved
7bd00e8 to
3ca108e
Compare
m-nash
left a comment
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.
Changes look good to me
There were only two places which were not AOT compatible:
Note: almost all of this code was generated by VS Code CoPilot w/ Agent Mode. If you're interested in the prompts I used and the chat session, contact me privately and I'd be happy to share the whole session.