-
Notifications
You must be signed in to change notification settings - Fork 334
Open
Labels
bugSomething isn't workingSomething isn't workingemitter:client:csharpIssue for the C# client emitter: @typespec/http-client-csharpIssue for the C# client emitter: @typespec/http-client-csharp
Description
Describe the bug
Description
The TypeSpec C# generator produces inconsistent variable names in the Deserialize* methods. A local variable is declared with one name but referenced with a different name later in the method.
Reproduction
In IndexingParametersConfiguration.Serialization.cs:
// Line 176 - variable declared as 'additionalProperties'
IDictionary<string, BinaryData> additionalProperties = new ChangeTrackingDictionary<string, BinaryData>();
// ... many lines later ...
// Line 301 - referenced as 'additionalBinaryDataProperties' (WRONG!)
additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText()));Expected Behavior
The variable name should be consistent throughout the method. Either:
- Declare as
additionalBinaryDataPropertiesand useadditionalBinaryDataProperties, OR - Declare as
additionalPropertiesand useadditionalProperties
Root Cause
The generator uses different naming conventions in different parts of the serialization template:
- One part uses the pattern matching the field name (
_additionalBinaryDataProperties?additionalBinaryDataProperties) - Another part uses a simpler name (
additionalProperties)
Affected Types
IndexingParametersConfigurationFacetResult- Potentially any type with additional/unknown properties handling
Reproduction
steps: Regenerate SDK on Azure.Search.Documents.
Repo: https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/search/Azure.Search.Documents/src
Checklist
- Follow our Code of Conduct
- Check that there isn't already an issue that request the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion.
- The provided reproduction is a minimal reproducible example of the bug.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingemitter:client:csharpIssue for the C# client emitter: @typespec/http-client-csharpIssue for the C# client emitter: @typespec/http-client-csharp