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
The method CreateLoggerDictionary() should be excluded from test coverage
Actual behavior
The method is not excluded from coverage
** Workaround **
Rewrite the code using foreach()
privatestaticDictionary<string,string>CreateLoggerDictionary(List<KeyValuePair<string,object>>attributes){Dictionary<string,string>dictionary=newDictionary<string,string>();foreach(var attribute in attributes){
dictionary.Add(attribute.Key, attribute.Value.ToString()??string.Empty);}returndictionary;}
Configuration (please complete the following information):
Please provide more information on your .NET configuration:
* Which coverlet package and version was used? v 6.0
* Which version of .NET is the code running on? .NET 6
* What OS and version, and what distro if applicable? Mac OS
* What is the architecture (x64, x86, ARM, ARM64)? ARM64
* Do you know whether it is specific to that configuration? No
bdurrani
changed the title
[BUG] ExcludeFromCodeCoverage
[BUG] ExcludeFromCodeCoverage does code exclude method in a partial class that contains a linq expression
Nov 6, 2023
Describe the bug
Please share a clear and concise description of the problem.
To Reproduce
I have the following class under Test
I used the following script to run the unit tests and generate the coverage reports
Expected behavior
The method
CreateLoggerDictionary()
should be excluded from test coverageActual behavior
The method is not excluded from coverage
** Workaround **
Rewrite the code using
foreach()
Configuration (please complete the following information):
Please provide more information on your .NET configuration:
* Which coverlet package and version was used? v 6.0
* Which version of .NET is the code running on? .NET 6
* What OS and version, and what distro if applicable? Mac OS
* What is the architecture (x64, x86, ARM, ARM64)? ARM64
* Do you know whether it is specific to that configuration? No
Additional context
I've attached the project here
Coverlet-Test.zip
The text was updated successfully, but these errors were encountered: