SIGN IN SIGN UP

Pass ModelReaderWriterContext in generated TryResolve{Property}Array helpers (#10839)

The `TryResolve{Property}Array` helpers were emitting
`ModelReaderWriter.Write(collection, options)` without the
`ModelReaderWriterContext` argument, breaking AOT-trimmed builds (e.g.
OpenAI) where the context-less overload isn't preserved.

## Changes

- **`ModelReaderWriterOptionsSnippets.cs`**: Added a new
`JsonFormatProperty` snippet that returns the
`ModelReaderWriterOptions.Json` static property.
- **`MrwSerializationTypeDefinition.Dynamic.cs`**: In
`BuildTryResolveArrayMethod`, append
`ModelReaderWriterContextSnippets.Default` to the
`ModelReaderWriter.Write` invocation, mirroring the pattern already used
in `BuildPersistableModelWriteCoreMethodBody` and the XML serialization
path. Also simplified the options argument to use the new
`ModelReaderWriterOptionsSnippets.JsonFormatProperty` snippet instead of
`new ModelReaderWriterOptions("J")`.
- **Test baseline**: Update `PropagateModelListPropertyHelperMethods.cs`
to expect the third argument and the `ModelReaderWriterOptions.Json`
static.

Generated output now matches the rest of the emitter:

```csharp
global::System.BinaryData data = global::System.ClientModel.Primitives.ModelReaderWriter.Write(
    ActiveP1(),
    global::System.ClientModel.Primitives.ModelReaderWriterOptions.Json,
    global::Sample.SampleContext.Default);
```

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com>
C
Copilot committed
8b0fcf3f34bcbc0cbc6fca78d2849037906fdd7e
Parent: 90dfcc1
Committed by GitHub <noreply@github.com> on 5/29/2026, 7:53:19 PM