Skip to content

Add non aot compatible support for collection reading and writing #49755

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

m-nash
Copy link
Member

@m-nash m-nash commented Apr 30, 2025

Fixes #48294

Should not be shipped until we release new version of all sdks which opt into AOT compatibility as mentioned in this tracking issue #48292

Needs to wait for #49945 and SCM 1.4.1 to go live.

@azure-sdk
Copy link
Collaborator

azure-sdk commented Apr 30, 2025

API Change Check

APIView identified API level changes in this PR and created the following API reviews

System.ClientModel

@m-nash m-nash marked this pull request as ready for review May 9, 2025 01:04
@Copilot Copilot AI review requested due to automatic review settings May 9, 2025 01:04
@m-nash m-nash requested a review from a team as a code owner May 9, 2025 01:04
Copy link
Contributor

@Copilot 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 adds non-AOT compatible support for collection reading and writing while updating testing and reflection-based builder components.

  • Updated test classes to indicate that reflection builder support is disabled.
  • Removed obsolete tests and replaced/refactored the ReflectionContext with a new ModelReaderWriterReflectionContext and additional reflection builder implementations.
  • Updated ModelReaderWriter methods and related API definitions with dynamic reflection attributes to support non-AOT scenarios.

Reviewed Changes

Copilot reviewed 34 out of 34 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
sdk/core/System.ClientModel/tests/ModelReaderWriterTests/Models/AvailabilitySetDatas/ImmutableDictionaryTests.cs Added override for HasReflectionBuilderSupport set to false.
sdk/core/System.ClientModel/tests/ModelReaderWriterTests/Models/AvailabilitySetDatas/ImmutableArrayTests.cs Added override for HasReflectionBuilderSupport set to false.
sdk/core/System.ClientModel/tests/ModelReaderWriterTests/Models/AvailabilitySetDatas/DictionaryIntKeyTests.cs Added override for HasReflectionBuilderSupport set to false.
sdk/core/System.ClientModel/tests/ModelReaderWriterTests/Models/AvailabilitySetDatas/CustomCollectionTests.cs Added override for HasReflectionBuilderSupport set to false.
sdk/core/System.ClientModel/tests/ModelReaderWriterTests/ModelReaderWriterGeneralTests.cs Removed tests for non-generic list reading which are now unsupported.
sdk/core/System.ClientModel/src/ModelReaderWriter/ReflectionModelBuilder.cs, Reflection* files Introduced several new reflection builder classes to support non-AOT usage and removed the old ReflectionContext.
sdk/core/System.ClientModel/src/ModelReaderWriter/ModelReaderWriter.cs Updated Write and Read methods to use the new ModelReaderWriterReflectionContext and added reflection attributes.
sdk/core/System.ClientModel/api/* Updated API definitions across target frameworks removing constraints and adding dynamic code attributes.

@azure-sdk
Copy link
Collaborator

API change check

APIView has identified API level changes in this PR and created following API reviews.

System.ClientModel

@m-nash m-nash marked this pull request as draft May 9, 2025 02:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE REQ] Enable existing Read methods to work with collections and add RequiresUnreferncedCode
3 participants