Compiler Warning (level 1) CS1723
XML comment has cref attribute 'attribute' that refers to a type parameter
This error is generated for an XML comment in case of using a <see/> tag with cross reference (cref) to a type parameter instead of the existing type (whether user-defined or built-in) in the code. It's impossible to link to 'attribute' of generic types because at the moment of creating the documentation the future type given as 'attribute' is not yet known.
To solve this issue <typeparamref/> tag should be used.
The following example contains a comment generating CS1723 as well as a reference that can be linked correctly.
public class Point
{
}
// compile with: /t:library /doc:filename.XML
///<summary>A generic list class.</summary>
///uses <see cref="T" /> // CS1723
///and <see cref="Point" /> // No warning
public class List<T, Point>
{
}
This example shows how to correctly link both generic type T
as well as already known user-defined Point
public class Point
{
}
// compile with: /t:library /doc:filename.XML
///<summary>A generic list class.</summary>
///uses <typeparamref name="T" /> // No warning
///and <see cref="Point" /> // No warning
public class List<T, Point>
{
}
.NET feedback
.NET is an open source project. Select a link to provide feedback: