feedback icon indicating copy to clipboard operation
feedback copied to clipboard

Attributes are not shown on parameters

Open svick opened this issue 2 years ago • 1 comments

Describe the bug

It seems attributes are not displayed for parameters in method signatures of .Net methods that have them.

To Reproduce

  1. Go to the API reference for ArgumentNullException.ThrowIfNull.

  2. Observe that the displayed method signature is:

    public static void ThrowIfNull (object? argument, string? paramName = default);
    

Expected behavior

The actual signature of the method is:

public static void ThrowIfNull([NotNull] object? argument, [CallerArgumentExpression("argument")] string? paramName = null)

Notice the following differences:

  1. The CallerArgumentExpression attribute is missing. This attribute significantly affects how the method is called, so I think it's important for it to be shown.
  2. The NotNull attribute is missing. This attribute observably affects the method, so I think it would be useful if it was also shown.
  3. The default value is shown as default instead of null. This is a cosmetic difference (both are technically correct), but I think that for reference types, null is clearer than default.

svick avatar Apr 15 '22 07:04 svick

Thanks @svick. I agree we need this support and I've logged an internal work item to track the work.

gewarren avatar Apr 18 '22 23:04 gewarren