microsoft / microsoft/typespec

C# acronym normalization ignores management SDK ApiCompat contracts

Open
#11,696 4 comments 1 reaction 1 assignee Claimed by @JoshLove-msft View on GitHub
bug emitter:client:csharp
Dominant language
Java
Stars
5.9k
Forks
394
Avg merge
1d 23h
Merged PRs (30d)
104

Description

### Describe the bug

The acronym normalization introduced by #11641 renames existing public management SDK types and properties even when their original names are present in the package's `ApiCompatVersion` contract.

The implementation is intended to normalize only new contract names and preserve names found through `FindForTypeInLastContract` or `LastContractView`. In a full Azure SDK for .NET management regeneration, that preservation does not occur consistently.

### Reproduction

Regenerate Azure SDK management packages using:

- `@typespec/http-client-csharp`: `1.0.0-alpha.20260813.5`
- `Azure.Generator`: `1.0.0-alpha.20260813.5`
- Full regeneration PR: Azure/azure-sdk-for-net#62087

Examples where the old name is present in the tagged GA API contract but is still renamed:

| Package / `ApiCompatVersion` | Existing contract name | Generated name |
| --- | --- | --- |
| `Azure.ResourceManager.OracleDatabase` / `1.2.1` | `OracleBaseDbSystemShape` | `OracleBaseDBSystemShape` |
| `Azure.ResourceManager.Network` / `1.16.1` | `VirtualNetworkApplianceIpVersionType` | `VirtualNetworkApplianceIPVersionType` |
| `Azure.ResourceManager.Sql` / `1.4.0` | `SyncMemberDbType` | `SyncMemberDBType` |
| `Azure.ResourceManager.SqlVirtualMachine` / `1.1.2` | `SqlVmOsType` | `SqlVMOSType` |
| `Azure.ResourceManager.PostgreSql` / `1.4.2` | `PostgreSqlMigrationLogicalReplicationOnSourceDb` | `PostgreSqlMigrationLogicalReplicationOnSourceDB` |

Machine Learning also renames existing GA properties including `PrivateIpAddress`, `PublicIpAddress`, `HostIp`, `OsVhdSizeMB`, and `IsLatestOsImageVersion`.

These changes cause compile failures where custom code or generated compatibility model-factory methods reference the contracted names. They also produce breaking public API changes in packages that otherwise compile.

### Expected behavior

If a public type or property exists in the assembly identified by `ApiCompatVersion`, preserve its existing spelling. Apply acronym normalization only to genuinely new contract members.

### Additional context

Names absent from the GA baseline are normalized as expected, so the issue appears specific to last-contract discovery or matching in the management generator integration rather than the normalization rules themselves.

​- by copilot

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.