coverlet icon indicating copy to clipboard operation
coverlet copied to clipboard

DoesNotReturnAttribute does not count correctly

Open sirkiza opened this issue 3 years ago • 4 comments

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:

image

Release Configuration:

image

Expected Behavior

100% coverage with DoesNotReturnAtttribute at least in Release configuration (ideally in both).

Thank you for help!

sirkiza avatar Dec 07 '21 11:12 sirkiza

Thanks for reporting this and providing a repro. :pray:

daveMueller avatar Dec 07 '21 12:12 daveMueller

The same situation here: https://app.codecov.io/gh/graphql-dotnet/parser/blob/master/src/GraphQLParser/LexerContext.cs изображение изображение ping @Shane32 FYI

sungam3r avatar Feb 03 '22 21:02 sungam3r

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.

MarcoRossignoli avatar Feb 05 '22 16:02 MarcoRossignoli

WOW! 👍 It works, thanks! https://github.com/graphql-dotnet/parser/pull/233

sungam3r avatar Feb 05 '22 20:02 sungam3r

This issue is stale because it has been open for 3 months with no activity.

github-actions[bot] avatar Sep 10 '23 01:09 github-actions[bot]

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.

Bertk avatar Feb 13 '24 14:02 Bertk