Skip to content

Handle Back Compat In Generated Model Operators Param Names #11669

Closed as not planned

Description

This scenario was encountered when building the latest event grid namespaces library:

C:\Users\jorgerangel\Development\AzureSdk\azure-sdk-for-net\eng\Directory.Build.Common.targets(579,5): error CP0017: Parameter name on member 'Azure.Messaging.EventGrid.Namespaces.AcknowledgeResult.explicit operator Azure.Messaging.EventGrid.Namespaces.AcknowledgeResult(Azure.Response)' changed from 'result' to 'response'.
    C:\Users\jorgerangel\Development\AzureSdk\azure-sdk-for-net\eng\Directory.Build.Common.targets(579,5): error CP0017: Parameter name on member 'Azure.Messaging.EventGrid.Namespaces.RejectResult.explicit operator Azure.Messaging.EventGrid.Namespaces.RejectResult(Azure.Response)' changed from 'result' to 'response'.
    C:\Users\jorgerangel\Development\AzureSdk\azure-sdk-for-net\eng\Directory.Build.Common.targets(579,5): error CP0017: Parameter name on member 'Azure.Messaging.EventGrid.Namespaces.ReleaseResult.explicit operator Azure.Messaging.EventGrid.Namespaces.ReleaseResult(Azure.Response)' changed from 'result' to 'response'.
    C:\Users\jorgerangel\Development\AzureSdk\azure-sdk-for-net\eng\Directory.Build.Common.targets(579,5): error CP0017: Parameter name on member 'Azure.Messaging.EventGrid.Namespaces.RenewLocksResult.explicit operator Azure.Messaging.EventGrid.Namespaces.RenewLocksResult(Azure.Response)' changed from 'result' to 'response'.
    C:\Users\jorgerangel\Development\AzureSdk\azure-sdk-for-net\eng\Directory.Build.Common.targets(579,5): error API breaking changes found. If those are intentional, the APICompat suppression file can be updated by rebuilding with '/p:ApiCompatGenerateSuppressionFile=true'

The generated operators are part of the public api shape. We should honor any previous parameter names on these operators.

Activity

  1. github-actions commented on Aug 14, 2026

    @github-actions
    Contributor

    🎯 Issue Triage

    The C# client emitter generates explicit conversion operators on model types (e.g., AcknowledgeResult, RejectResult, etc.) using a parameter name (response) that differs from the previously published API (result), causing breaking API compatibility errors in the Azure SDK for .NET.

    Category: Bug
    Area: emitter:client:csharp

    ⚠️ No reproduction provided. A minimal repro would help diagnose this issue.

    🔍 Analysis
    • Affected component: @typespec/http-client-csharp — code generation for model explicit operator methods
    • Root cause: The generated parameter name for explicit cast operators changed from result to response, breaking API compatibility as detected by APICompat in the Azure SDK for .NET
    • Impact: Any library using generated operators (e.g., EventGrid Namespaces) that has been previously released will fail API compatibility checks, blocking releases
    • Affected models: AcknowledgeResult, RejectResult, ReleaseResult, RenewLocksResult
    • Fix direction: The emitter should preserve previously established parameter names when generating these operators, or provide a mechanism (e.g., customization hook) to explicitly set them
    📝 Suggested next steps
    • Identify where in the C# emitter these operator parameter names are generated
    • Determine if this was an intentional rename or a regression
    • Implement a fix to use stable/consistent parameter names (e.g., always response for Azure.Response conversions, or honor a prior name)
    • Consider whether existing API suppression files need to be updated as a stopgap

    Generated by Agentic Triage

  2. jorgerangel-msft commented on Aug 17, 2026

    @jorgerangel-msft
    ContributorAuthor

    This is a false positive. We can just suppress this in the apicompat baseline as we encounter it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't workingemitter:client:csharpIssue for the C# client emitter: @typespec/http-client-csharp

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions