In Visual Studio 2017 a closing brace after a statement that is throwing an exception is considered uncovered.
In my case I have a test checking if a NullReferenceException is thrown:
[Fact]
public void PassingNullConsoleWriter_ThrowsArgumentNullException()
{
Assert.Throws<ArgumentNullException>(() => new UsagePrinter(null));
}
Analyzing code coverage in this form of the code marks the whole body of the lambda as uncovered, what obviously is not true:
Expanding the lambda to a statement lambda uncovers that actually it is the closing brace after the statement throwing the exception that is considered uncovered:
Note that the overall coverage of the file in both cases is the same.
Is there anything I can do about this?

