用于测试项目/类的 .editorconfig

问题描述

我在整个解决方案的全局级别使用 .editorconfig 文件。到目前为止,这工作正常。现有规则确实有效。

现在我想要为我的测试项目和类设置 VSTHRD200 的规则,我添加了以下几行:

# Test projects
[{IntegrationTest.*,Test.*}.csproj]
dotnet_diagnostics.VSTHRD200.severity = none # VSTHRD200: Use "Async" suffix for async methods
dotnet_analyzer_diagnostic.VSTHRD200.severity = none # VSTHRD200: Use "Async" suffix for async methods

# Test classes
[Test*.cs]
dotnet_diagnostics.VSTHRD200.severity = none # VSTHRD200: Use "Async" suffix for async methods
dotnet_analyzer_diagnostic.VSTHRD200.severity = none # VSTHRD200: Use "Async" suffix for async methods

这些规则在某种程度上确实有效,我在输出窗口中看不到警告。但是这些规则不适用于 category-Style,这意味着我确实看到测试方法的卷线,它在编辑器中没有 Async 后缀。

我已经像 VS 2019 建议的那样添加了 dotnet_analyzer_diagnostic.category-Style.severity = none 并将它们放在测试项目和类的部分标题下,但我感觉它会禁用所有样式规则.

有没有办法只禁用 VSTHRD200 错误代码的样式?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...