Pass ModelReaderWriterContext in generated TryResolve{Property}Array helpers#10839
Merged
jorgerangel-msft merged 5 commits intoMay 29, 2026
Merged
Conversation
4 tasks
…Property}Array Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix TryResolve{Property}Array methods to include missing argument
Pass ModelReaderWriterContext in generated TryResolve{Property}Array helpers
May 29, 2026
Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com>
commit: |
Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com>
jorgerangel-msft
approved these changes
May 29, 2026
Contributor
|
@copilot there are CI failures. We need to regenerate all the test libraries and ensure all tests pass |
Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com>
Contributor
Author
Regenerated the test libraries in e43c738 — |
JoshLove-msft
approved these changes
May 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
TryResolve{Property}Arrayhelpers were emittingModelReaderWriter.Write(collection, options)without theModelReaderWriterContextargument, breaking AOT-trimmed builds (e.g. OpenAI) where the context-less overload isn't preserved.Changes
ModelReaderWriterOptionsSnippets.cs: Added a newJsonFormatPropertysnippet that returns theModelReaderWriterOptions.Jsonstatic property.MrwSerializationTypeDefinition.Dynamic.cs: InBuildTryResolveArrayMethod, appendModelReaderWriterContextSnippets.Defaultto theModelReaderWriter.Writeinvocation, mirroring the pattern already used inBuildPersistableModelWriteCoreMethodBodyand the XML serialization path. Also simplified the options argument to use the newModelReaderWriterOptionsSnippets.JsonFormatPropertysnippet instead ofnew ModelReaderWriterOptions("J").PropagateModelListPropertyHelperMethods.csto expect the third argument and theModelReaderWriterOptions.Jsonstatic.Generated output now matches the rest of the emitter: