Skip to content

Conversation

@agocke
Copy link
Contributor

@agocke agocke commented May 16, 2025

There were only two places which were not AOT compatible:

  1. Use of non-source generated JSON.
  2. One method which uses non-generated configuration bindings, which I've simply marked incompatible for now.

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.

Copilot AI review requested due to automatic review settings May 16, 2025 21:42
@github-actions github-actions bot added Community Contribution Community members are working on the issue customer-reported Issues that are reported by GitHub users external to the Azure organization. Mgmt This issue is related to a management package. labels May 16, 2025
@github-actions
Copy link

Thank you for your contribution @agocke! We will review the pull request and get back to you soon.

Copy link
Contributor

Copilot AI left a 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.

@jsquire jsquire requested review from m-nash and m-redding May 16, 2025 23:31
@jsquire
Copy link
Member

jsquire commented May 16, 2025

@m-nash: Could you give this another pair of eyes from the management + MRW perspective?
@m-redding: Could you give this an AOT look?

@agocke
Copy link
Contributor Author

agocke commented May 16, 2025

FYI, still trying to repro those code generation failures locally. For some reason restore is taking forever

Copy link
Member

@jsquire jsquire left a 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.

@jsquire
Copy link
Member

jsquire commented May 16, 2025

@agocke: The failures are:

  • The new attributes constitute a change in the API shape, so you'll need to export via: eng\scripts\Export-API.ps1 core
  • The serialization format for managed identity seems to have changed enough that the recording no longer matches. That may or may not be a concern.

@agocke
Copy link
Contributor Author

agocke commented May 19, 2025

I've fixed up all the formatting and added the attribute, so I think this is ready to go.

Copy link
Member

@m-redding m-redding left a 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

@jsquire
Copy link
Member

jsquire commented May 21, 2025

@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.

@m-nash
Copy link
Member

m-nash commented May 22, 2025

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

@agocke agocke force-pushed the annotate-azure-resourcemanager branch from 7bd00e8 to 3ca108e Compare July 1, 2025 22:29
Copy link
Member

@m-nash m-nash left a 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

@m-nash m-nash merged commit 855f304 into Azure:main Jul 10, 2025
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Community Contribution Community members are working on the issue customer-reported Issues that are reported by GitHub users external to the Azure organization. Mgmt This issue is related to a management package.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants