我已经安装了 StyleCop.Analyzers nuget(版本 1.0.0),并且我已经配置了 SA1515(单个注释前面必须有空行),以便在违规时出错。
但是以下代码
namespace ConsoleApplication6
{
class Program
{
static void Main(string[] args)
{
int x = 2;
/// my comment
int y = 3;
}
}
}
仅在输出窗口中将违规显示为
ConsoleApplication6\Program.cs(8,7,8,9): error SA1515: Single-line comment must be preceded by blank linelists the error
但错误窗口中没有曲线,也没有任何条目。将
///
更改为 //
会使错误立即出现在错误列表中。
有没有办法调试这个以找到有问题的地方?我已经在 Visual Studio 中打开了从 GitHub 获得的源代码,在该规则类中的一个
context.ReportDiagnostic
调用上设置了一个断点,设置为在调试启动时启动另一个 VS 实例,在其中打开了 ConsoleApplication6 并且从未中断过点击。
这是很久以前的事了,但我现在遇到了同样的问题(Visual Studio 2022)。我发现,如果您删除 csproj 中的 -Tag,它就会起作用,并且错误会出现在错误列表中。
但现在我试图找出警告级别 4 和无警告级别之间的区别(因为 4 似乎是默认值)...