Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xmldoc with <see cref="Foo{T}(T?)"/> or similar fails to compile #33782

Closed
cyanite opened this Issue Mar 1, 2019 · 4 comments

Comments

@cyanite
Copy link
Contributor

cyanite commented Mar 1, 2019

Visual Studio 2019 RC (csc.exe version 3.0.19.12206 (ec36668)):

Steps to Reproduce:

Write this code. Note that Visual Studio helps you complete the <see cref...>. Enable XML documentation file and enable all warnings as errors.

using System;
namespace Repro2
{
    /// <summary/>
    public class Class1
    {
        void Foo<T>(T t) where T : class { }
        void Foo<T>(T? t) where T : struct { }

        /// <summary>
        /// See <see cref="Foo{T}(T?)"/>
        /// </summary>
        void Bar() { }
    }
}

Expected Behavior:
It works.

Actual Behavior:
It fails with CS1580 Invalid type for parameter T? in XML comment cref attribute: 'Foo{T}(T?)'

If you change it to <see cref="Foo{T}(Nullable{T})"/> it works, but Visual Studio will now nag you to change it back to the version that doesn't :p.

This is a regression; both syntaxes worked in Visual Studio 2017. The old compiler produced the following in the document file:

<see cref="M:Repro2.Class1.Foo``1(System.Nullable{``0})"/>

The new one produces:

<see cref="M:Repro2.Class1.Foo``1(``0)"/>

(and warns/fails if warnings as errors is enabled.)

@gafter

This comment has been minimized.

Copy link
Member

gafter commented Mar 4, 2019

It appears the addition of the nullable ref types feature may have introduced a regression here.

@jaredpar jaredpar added this to Misc in Nullable Board Mar 4, 2019

@jcouv jcouv self-assigned this Mar 11, 2019

@jcouv

This comment has been minimized.

Copy link
Member

jcouv commented Mar 11, 2019

Confirmed this is a regression (15.9 accepts this xml doc). Investigating....

@jcouv

This comment has been minimized.

Copy link
Member

jcouv commented Mar 15, 2019

Fixed for dev16 (rc4)

@jcouv jcouv closed this Mar 15, 2019

@jcouv

This comment has been minimized.

Copy link
Member

jcouv commented Mar 15, 2019

Thanks @cyanite for reporting this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.