Repository navigation
Fix C# integer mappings and serialization - #12283
Merged
Jorge Rangel (jorgerangel-msft) merged 2 commits intoOct 15, 2026
Merged
Conversation
Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com>
…paths Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com>
|
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. |
Copilot
AI
changed the title
fix(http-client-csharp): preserve integer types in generated clients
Fix C# integer mappings and serialization
Oct 15, 2026
JoshLove-msft
approved these changes
Oct 15, 2026
Jorge Rangel (jorgerangel-msft)
marked this pull request as ready for review
October 15, 2026 19:46
Jorge Rangel (jorgerangel-msft)
requested review from
Jose Arriaga Maldonado (joseharriaga) and
m-nash
as code owners
October 15, 2026 19:46
commit: |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Numeric collection support remains incomplete in request serialization and response deserialization.
2 open findings
What changed in this PR
Fixes C# integer mappings so generated SDKs preserve numeric types instead of using object.
Changes:
- Maps four integer types to their C# equivalents.
- Adds unsigned JSON serialization and lossless
ulongXML writes. - Updates tests and generated baselines.
| File | Description |
|---|---|
| packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/Models/Uint32AsStringProperty.cs | Uses nullable uint. |
| packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/EncodeNumericModelFactory.cs | Updates factory parameter type. |
| packages/http-client-csharp/generator/TestProjects/Spector.Tests/Http/Encode/Numeric/EncodeNumericTests.cs | Checks typed numeric values. |
| packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Internal/ModelSerializationExtensions.cs | Regenerates integer serialization cases. |
| packages/http-client-csharp/generator/TestProjects/Local.Tests/ModelSerializationExtensionsTests.cs | Tests integer range boundaries. |
| packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/test/TypeFactoryTests.cs | Tests primitive and collection mappings. |
| packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/TypeFactory.cs | Adds missing integer mappings. |
| packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/XmlSerializationTests.cs | Tests integer XML writes. |
| packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/MrwSerializationTypeDefinitionTests.cs | Expands integer serialization tests. |
| packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/TestData/ModelSerializationExtensionsDefinitionTests/ValidateWriteObjectValueXmlIncludesFileBinaryContentCase.cs | Updates serialization baseline. |
| packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/TestData/ModelSerializationExtensionsDefinitionTests/ValidateWriteObjectValueIncludesFileBinaryContentCase.cs | Updates serialization baseline. |
| packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/JsonElementSnippets.cs | Adds unsigned JSON getters. |
| packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/MrwSerializationTypeDefinition.Xml.cs | Preserves ulong XML precision. |
| packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/MrwSerializationTypeDefinition.cs | Supports unsigned JSON deserialization. |
| packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ModelSerializationExtensionsDefinition.cs | Adds integer object-write cases. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Jorge Rangel (jorgerangel-msft)
approved these changes
Oct 15, 2026
4 tasks done
Jorge Rangel (jorgerangel-msft)
approved these changes
Oct 15, 2026
Jesse Squire (jsquire)
approved these changes
Oct 15, 2026
Jorge Rangel (jorgerangel-msft)
deleted the
copilot/address-pr-comment-issue
branch
October 15, 2026 22:13
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.

Missing integer mappings caused
uint32[]to generateIList<object>, requiring custom SDK wrappers. This change preserves numeric types and fills the corresponding serialization gaps.int16,uint16,uint32, anduint64toshort,ushort,uint, andulong, including nullable types and collections.ulongXML writes.For a TypeSpec property declared as
bottom_right: uint32[], generate:rather than
IList<object>.