DotCover - Local Methods and Auto Properties
After installing the latest version of ReSharper I am no longer getting code coverage figures for automatic properties or local methods. Both of these were reported in 2025.2.0.1.
Writing unit tests for automatic properties are a bit of a nonsense, but it is something that my client insists on, and their sonarqube instance includes them in their coverage metrics so I still have to write them.
Local methods are reported as a single line in the coverage metrics, i.e. methods that call local methods may be reported as only being three lines long, when in fact they comprise many tens of lines but all within three local methods. Again, sonarqube doesn't do this so I'm failing metrics on things that should be getting caught.
Please sign in to leave a comment.
Hello Adam,
Thanks for contacting JetBrains support.
In 2025.2, we indeed made some changes to the dotCover filtering system. Auto properties were previously excluded by default, but we removed this default filter. As a result, users should now see auto properties included in reports (the opposite of what you’re observing).
To help us better understand the issue, could you please provide the following information:
1. The snapshots(.dcvr file) on 2025.2.0.1 and latest version
2. The code snippets or a minimal sample that can demonstrate the issue.
Please upload the files to the Upload Service and share the Upload ID.
Thanks,
Tom
Thanks Tom,
I've created a sample application showing the issue. Upload Id: 2026_02_20_24eRchHrbrvX8gko7Lkn3W.
The upload shows that there is a simple DTO with three settable auto properties, and one get-only property.
Unit tests are written against all four properties, and all have run and passed.
The code coverage report and in-editor highlighting shows that the auto properties are not included in the coverage metrics, and that the class only has one coverable line which is the get-only property.
I was not able to reproduce the issue with local method coverage - maybe this has been fixed? So let's just concentrate on the issue with auto-properties.
Hello Adam,
I appreciate your efforts to share the repro sample - it's a great help for us to investigate the issue. I can reproduce the issue on my end. I'm trying to confirm the technical details with the development team.
In the meantime, a workaround that works for me is to go to ReSharper | Options | dotCover | Filtering, then uncheck "System.Runtime.CompilerServices.ComilerGeneratedAttribute" filter:
Please let me know if this doesn't work for you.
Regards,
Tom
Hi Tom,
I was just wondering if you had managed to learn what was going on from the development team yet?
Your workaround is useful, but it also means that other code is analysed that I don't want analysing. Currently this is preventing me from moving to newer versions of ReSharper for something that should be pretty simple to sort.
Thanks
Hello Adam,
The current situation should improve significantly once we implement DCVR-13211 Refined filtering system. The workaround should no longer be necessary when it's ready.
The feature is currently in active development and is tentatively scheduled for release in 2026.3. Please note that timelines may shift based on development progress. For the latest updates, you can subscribe to receive status updates.
Thanks,
Tom