-
-
Couldn't load subscription status.
- Fork 273
Closed
Labels
Description
Product and Version Used:
VS extension Roslynator 2022 v4.12.5
Steps to Reproduce:
- Enable
RCS1181in your.editorconfigfile (disabled by default). - Make sure the containing project is configured to generate documentation files:
- Open project Properties.
- Go to page Build -> Output
-
- Generate a file containing API documentation
- Open a C# file and add a comment after the namespace.
Actual Behavior:
namespace MyNamespace // Some comment. <-- RCS1181: Convert comment to documentation comment
{
/// <summary>
/// ...
/// </summary>
public class Class1
{
internal int MyProperty { get; set; }
}
}which is wrong, because applying the code fix produces code that triggers a compiler error:
/// <summary> <-- CS1587: XML comment is not placed on a valid language element
/// Some comment.
/// </summary>
namespace MyNamespace
{
/// <summary>
/// ...
/// </summary>
public class Class1
{
internal int MyProperty { get; set; }
}
}Expected Behavior:
namespace MyNamespace // Comment. <-- No RCS1181
{
/// <summary>
/// ...
/// </summary>
public class Class1
{
internal int MyProperty { get; set; }
}
}You can't add documentation comments to a namespace (see first table here).
Bottom line: RCS1181 should never be reported for comments on namespaces.