什么规则(Resharper/C# .editorconfig)将"throw new()"重写为"throw new Exception()"?



我在签入时运行Resharper CLI以更漂亮的方式清理c#代码。它工作得很好,但我遇到了一个问题,其中throw new()被重写为throw new Exception()。我们主要使用它作为一个非常简短的可空性检查,例如return somethingNullable ?? throw new()

我在.editorconfig中发现的唯一规则是:

csharp_style_throw_expression = true:suggestion

但是删除这个规则并不能解决问题。

我尝试了--verbose日志,虽然它显示了所有的文件输出,但它似乎没有提供关于什么规则实际导致更改的线索。

很可能是csharp_object_creation_when_type_not_evident(参见r# docs)。

最新更新