roslyn: Xmldoc with or similar fails to compile
Visual Studio 2019 RC (csc.exe version 3.0.19.12206 (ec366687)):
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.)
About this issue
- Original URL
- State: open
- Created 5 years ago
- Reactions: 2
- Comments: 17 (13 by maintainers)
I found a minimal reproducer. It seems that having a LangVersion < 8 is key.
Project.csproj
Program.cs