.net core 在.Net Core 3.1中,如何将自动属性排除在代码覆盖范围之外?

.net core 在.Net Core 3.1中,如何将自动属性排除在代码覆盖范围之外?,.net-core,code-coverage,.net Core,Code Coverage,这个问题是我对VS2019和.NETCore3.1的现代转世只感兴趣 我当前的CodeCoverage.runsettings文件包含以下部分: <Attributes> <Exclude> <Attribute>^System\.Diagnostics\.DebuggerHiddenAttribute$</Attribute> <Attribute>^System\.Diagnostics\.DebuggerNon

这个问题是我对VS2019和.NETCore3.1的现代转世只感兴趣

我当前的CodeCoverage.runsettings文件包含以下部分:

<Attributes>
  <Exclude>
    <Attribute>^System\.Diagnostics\.DebuggerHiddenAttribute$</Attribute>
    <Attribute>^System\.Diagnostics\.DebuggerNonUserCodeAttribute$</Attribute>
    <Attribute>^System\.CodeDom\.Compiler\.GeneratedCodeAttribute$</Attribute>
    <Attribute>^System\.Runtime\.CompilerServices\.CompilerGeneratedAttribute$</Attribute>
    <Attribute>^System\.Diagnostics\.CodeAnalysis\.ExcludeFromCodeCoverageAttribute$</Attribute>
  </Exclude>
</Attributes>

^系统\.Diagnostics\.DebuggerHiddenAttribute$
^系统\.Diagnostics\.DebuggerNonUserCodeAttribute$
^System\.CodeDom\.Compiler\.GeneratedCodeAttribute$
^系统\.Runtime\.CompilerServices\.CompilerGeneratedAttribute$
^系统\.Diagnostics\.CodeAnalysis\.ExcludeFromCodeOverageAttribute$
关键是,自动属性的属性是
CompilerGenerated
属性。但是,这种方法是错误的,因为
async
方法也被编译器转换成具有相同属性的方法。因此,使用这种方法,我们失去了
async
方法的覆盖范围。不太好


那么,在VS代码覆盖中是否有一种方法可以像在OpenCover或DotCover中那样跳过对自动属性的覆盖?

以下内容添加到我的
。runsettings
文件排除了自动道具,但不包括手动编码的属性或异步方法

*获取*
*设置*
不完美,但是

     <Function>.*get_.*</Function>
     <Function>.*set_.*</Function>