coverlet
coverlet copied to clipboard
DoesNotReturnAttribute does not count correctly
Hi people! I am facing an issue coverlet. Looking forward for help :)
Background
I noticed some inconsistency in calculation of code coverage using methods marked with DoesNotReturnAtttribute. First of all the method marked with DoesNotReturnAtttribute evaluate fine only in Release mode (not in Debug one). That worked good till until recently.
Description
The code can be found here.
In the code sample you can see Helper.ArgumentException which is forcing no inline and marked with DoesNotReturnAtttribute.
And the most confusing part, that the results will remain the same after deleting DoesNotReturnAtttribute from static Helper.ArgumentException!
After running tests that should fully cover Add method of NameDict I got:
Debug Configuration:

Release Configuration:

Expected Behavior
100% coverage with DoesNotReturnAtttribute at least in Release configuration (ideally in both).
Thank you for help!
Thanks for reporting this and providing a repro. :pray:
The same situation here:
https://app.codecov.io/gh/graphql-dotnet/parser/blob/master/src/GraphQLParser/LexerContext.cs
ping @Shane32 FYI
Can you try to enable the feature? https://github.com/coverlet-coverage/coverlet/blob/master/Documentation/MSBuildIntegration.md#methods-that-do-not-return (same element for the collector integration)
it's disabled by default because we had some issue with this feature that lead to hang.
For the release/debug it's expected...coverlet is sequence point based at the moment and for release/debug compilers emits different sequences.
WOW! 👍 It works, thanks! https://github.com/graphql-dotnet/parser/pull/233
This issue is stale because it has been open for 3 months with no activity.
Can you try to enable the feature? https://github.com/coverlet-coverage/coverlet/blob/master/Documentation/MSBuildIntegration.md#methods-that-do-not-return (same element for the collector integration)
it's disabled by default because we had some issue with this feature that lead to hang.
For the release/debug it's expected...coverlet is sequence point based at the moment and for release/debug compilers emits different sequences.
Resolved enabling optional feature.