You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fix C# JSON request and response handling for integer collections - #12295
Nested JSON requests containing int16, uint16, uint32, or uint64 collections can throw NotSupportedException; top-level array and record responses can return empty collections despite populated payloads.
Request serialization: Use non-generic IEnumerable for recursive collection handling, preserving dictionary-as-object and byte-array-as-base64 precedence.
Response deserialization: Extend conversion gates and numeric getters for short, ushort, uint, and ulong, including nullable elements.
Regression coverage: Exercise generated sync/async request and response paths across all four types, including range boundaries, empty collections, null entries, invalid values, and dictionary/byte-array compatibility.
Azure Pipelines:
Successfully started running 1 pipeline(s).
1 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.
CopilotAI
changed the title
[WIP] Fix JSON request/response support for integer collections
Fix C# JSON request and response handling for integer collections
Oct 16, 2026
Nested integer collections fail to serialize in JSON request bodies
Top-level integer collection and record responses deserialize as empty collections...
Yes—both fixes are included. Added explicit request coverage in db18db6:
NestedIntegerCollectionRequestsUseBinaryContentHelpers checks generated sync/async request methods against TestData. NestedIntegerRequestBodiesSerialize adds 64 cases covering nested arrays and records of arrays for all four types, including lists, boundaries, null elements, and empty collections. All 64 fail with NotSupportedException using the pre-fix helper and pass with the fix.
IntegerCollectionResponsesUseUtf8JsonReader checks TestData baselines for top-level arrays/records across all four types, including nullable elements and sync/async methods. These were also verified to fail against the pre-fix generator.
All 2,463 ClientModel and 796 Local unit tests pass. Sample-TypeSpec fixtures remain unchanged.
Copilot there's test failures we need to address and possibly regenerate the test libraries:
Synchronized the checked-in Local Sample-TypeSpec generated source to the generator’s foreach (var item ...) output in commit $(git rev-parse --short HEAD). The focused ClientModel tests (10) and Local tests (796) pass. The repository generation script could not rebuild the emitter here because @types/node is unavailable, so I applied the exact generated one-line diff.
These tests call BinaryContentHelper with object-typed collections, and ScmMethodProviderCollectionTests.cs:2535–2558 only compares generated source, so neither verifies requests sent by generated sync/async client methods as required by #12284. Add tests calling generated nested-array and record-of-arrays operations for short, ushort, uint, and ulong, and assert the captured JSON bodies; switching between WriteTo and WriteToAsync here does not exercise those client methods.
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
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.
Nested JSON requests containing
int16,uint16,uint32, oruint64collections can throwNotSupportedException; top-level array and record responses can return empty collections despite populated payloads.IEnumerablefor recursive collection handling, preserving dictionary-as-object and byte-array-as-base64 precedence.short,ushort,uint, andulong, including nullable elements.