roslyn icon indicating copy to clipboard operation
roslyn copied to clipboard

C# 10 nullable type "?" character display seems inconsistent in the Intellisense display of the XML documentation

Open vsfeedback opened this issue 3 years ago • 1 comments

This issue has been moved from a ticket on Developer Community.


[severity:It bothers me. A fix would be nice] Consider the following code snippet:

/// <summary>
/// Serializes this <see cref="ICollection"/>? object to a <see cref="string?"/>, skipping nulls.
/// </summary>
/// <param name="val">The value to process.</param>
/// <param name="separator">Optional separator.</param>
/// <returns><see cref="string?"/>.</returns>
public static string? SerializeToString(this ICollection? val, string? separator = null)
{
	if (val is null)
		return null;

With reference to the XML documentation, with cref="ICollection?"/>, Intellisense will not display the ?, which is why I put it after the <see /> block.

However, with <see cref="string?"/>, it will display the ?.

<see cref="MatchCollection?"/> won't display the ?.

Two of these examples are classes, one is an interface.

I noticed the ? won't display with generics, such as public A[]? MyFunc().


Original Comments

Feedback Bot on 4/18/2022, 05:52 AM:

(private comment, text removed)

Feedback Bot on 4/18/2022, 07:29 PM:

(private comment, text removed)


Original Solutions

(no solutions)

vsfeedback avatar Apr 19 '22 04:04 vsfeedback

💭 I would not expect a cref to a nullable reference type to work in any situation prior to the language supporting documentation references to constructed types (dotnet/csharplang#401).

sharwell avatar Apr 19 '22 04:04 sharwell