Feature request
Please add support for formatting generated C# method references as XML documentation cref elements.
Scenario
The Azure SDK management generator needs to emit documentation that points from an extension method to the mockable method users should mock instead:
<description>To mock this method, please mock <see cref="MockableType.Method(Type1, Type2)"/> instead.</description>
For methods with generic parameter types, the cref must use XML-doc generic syntax, for example:
<see cref="MockableAzureGeneratorMgmtTypeSpecTestsSubscriptionResource.GetBazsAsync(int?, IEnumerable{string}, CancellationToken)"/>
Current behavior
I validated the existing C# generator :C formatter in two ways:
- Formatting individual
CSharpType values with :C and composing them inside cref="..." does not work because :C emits complete XML doc tags/prose, such as <see cref="Type"/> or <see cref="IEnumerable{T}"/> where <c>T</c> is of type <see cref="string"/>.
- Formatting
MethodSignature directly with :C, for example $"To mock this method, please mock {targetSignature:C} instead.", compiles but emits <see cref="Generator.Primitives.MethodSignature"/>, referencing the MethodSignature type rather than the represented generated method.
CSharpType also does not appear to expose an XML-doc cref string conversion API. ToString() emits C# syntax such as global::System.Collections.Generic.IEnumerable<string>, not XML-doc cref syntax such as IEnumerable{string}.
Requested API/behavior
Please consider supporting :C on a generated C# method representation, such as MethodSignature or MethodProvider, to emit a complete cref element for the represented generated method, including the declaring type and parameter type list.
If the declaring type cannot be inferred from MethodSignature, a helper/API that accepts the declaring CSharpType plus the method signature would also work.
This would let generators rely on base C# generator XML-doc formatting instead of manually building cref strings and generic type parameter syntax.
Context: Azure SDK issue Azure/azure-sdk-for-net#60758
Feature request
Please add support for formatting generated C# method references as XML documentation cref elements.
Scenario
The Azure SDK management generator needs to emit documentation that points from an extension method to the mockable method users should mock instead:
For methods with generic parameter types, the cref must use XML-doc generic syntax, for example:
Current behavior
I validated the existing C# generator
:Cformatter in two ways:CSharpTypevalues with:Cand composing them insidecref="..."does not work because:Cemits complete XML doc tags/prose, such as<see cref="Type"/>or<see cref="IEnumerable{T}"/> where <c>T</c> is of type <see cref="string"/>.MethodSignaturedirectly with:C, for example$"To mock this method, please mock {targetSignature:C} instead.", compiles but emits<see cref="Generator.Primitives.MethodSignature"/>, referencing theMethodSignaturetype rather than the represented generated method.CSharpTypealso does not appear to expose an XML-doc cref string conversion API.ToString()emits C# syntax such asglobal::System.Collections.Generic.IEnumerable<string>, not XML-doc cref syntax such asIEnumerable{string}.Requested API/behavior
Please consider supporting
:Con a generated C# method representation, such asMethodSignatureorMethodProvider, to emit a complete cref element for the represented generated method, including the declaring type and parameter type list.If the declaring type cannot be inferred from
MethodSignature, a helper/API that accepts the declaringCSharpTypeplus the method signature would also work.This would let generators rely on base C# generator XML-doc formatting instead of manually building cref strings and generic type parameter syntax.
Context: Azure SDK issue Azure/azure-sdk-for-net#60758