You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The ExcludeFromCodeCoverage attribute does not exclude code inside a task workflow in an F# function
To Reproduce
Project Code
namespace src
open System.Diagnostics.CodeAnalysis
open System.Threading.Tasks
module Say =
[<ExcludeFromCodeCoverage>]
let hello name =
[|for i in 0 .. 10 do
task {
printfn $"Task {i} Hello %s{name}"
} :> Task|]
|> Task.WaitAll
printfn $"Hello %s{name}"
let formatHello name =
$"Hello %s{name}!"
Unit Test
module test
open NUnit.Framework
[<Test>]
let formatMessage () =
let helloWorld = src.Say.formatHello "World"
Assert.That(helloWorld, Is.EqualTo("Hello World!"))
Generate Code Coverage via command line
dotnet test --collect:"XPlat Code Coverage"
Expected behavior
Expect the coverage file to not include any code in the hello function.
Actual behavior
Coverage file picks up the body of the task in the hello function. It's listed as method MoveNext() line 13.
Configuration (please complete the following information):
Please provide more information on your .NET configuration:
* Which coverlet package and version was used? - 6.0.0
* Which version of .NET is the code running on? - 7.0.403
* What OS and version, and what distro if applicable? - macOS
* What is the architecture (x64, x86, ARM, ARM64)? - arm64
* Do you know whether it is specific to that configuration? - no
The text was updated successfully, but these errors were encountered:
Describe the bug
The ExcludeFromCodeCoverage attribute does not exclude code inside a task workflow in an F# function
To Reproduce
Project Code
Unit Test
Generate Code Coverage via command line
Expected behavior
Expect the coverage file to not include any code in the hello function.
Actual behavior
Coverage file picks up the body of the task in the hello function. It's listed as method MoveNext() line 13.
coverage.cobertura.xml
Configuration (please complete the following information):
Please provide more information on your .NET configuration:
* Which coverlet package and version was used? - 6.0.0
* Which version of .NET is the code running on? - 7.0.403
* What OS and version, and what distro if applicable? - macOS
* What is the architecture (x64, x86, ARM, ARM64)? - arm64
* Do you know whether it is specific to that configuration? - no
The text was updated successfully, but these errors were encountered: