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
{{ message }}
Repository navigation
Results Not Available For Classes That Have Only async Methods #532
If all methods in a class are async, then FCC does not seem to detect the class at all or include coverage information for that class in the output.
If any method of the class is not async, then FCC does detect the class and include coverage in the output, including for any async methods that might be in the class.
For example, FCC does not seem to properly report coverage when testing the following class:
public class AsyncCalc
{
public static async Task<int> Add(int a, int b)
{
return a + b;
}
public static async Task<int> Subtract(int a, int b)
{
return a - b;
}
}
Then the sut assembly has likely not been included or the class itself has been excluded.
In the assembly with the class with only async methods are you receiving coverage for other classes ?
If you are using the option MsCodeCoverage - Yes and have not provided your own runsettings then you can check the generated .runsettings file within a sub directory of your test project's bin/Debug/../fine-code-coverage/coverage-tool-output
If not MsCodeCoverage then the FCC output window pane shows the command line arguments used to run the coverage.
You should check the FCC output window pane regardles.
If this is not sufficient for you to determine why you have no coverage then you need to provide a minimal reproducible solution that exhibits this behaviour and provide the FCC visual studio options that you have set.
Thanks for the assistance. Your project does not compile for me without changing the signature of WhenAllAsync to
public async Task WhenAllAsync()
After making that change, I am seeing the same behavior with your project.
Here is the project where I am producing this. I have two classes in the assembly under test, one that uses async methods and one that uses sync methods. The async class has source code showing as "not included' while the sync class is showing coverage as expected. FCCBug.zip
Here is my FCC output including the generated runsettings file (note that I have redacted system path and user information):
I think the issue is with report generator not understanding the cobertura report that is generated from microsoft code coverage. Report generator is used for resolving names and producing the final cobertura report that FCC uses. Unfortunately with the version of report generator that FCC is currently using ( which cannot be changed easily as we are embedding their HTML report which is no longer supported in WebBroswer form ) this is indeed an issue and I apologize for being flippant before.
As a workaround you can set RunMsCodeCoverage No.
A better report that is up to date with report generator will be available soon.
Activity
tonyhallett commentedon Jul 14, 2025
Albeit from a fork of FCC
Have you turned off showing coverage when a class is fully covered ?
tonyhallett commentedon Jul 14, 2025
HideFullyCovered | Set to true to hide classes, namespaces and assemblies that are fully covered.
( just in case )
Hide0Coverage | Set to true to hide classes, namespaces and assemblies that have 0% coverage.
slagesse-epic commentedon Jul 14, 2025
Hm, that's definitely not what I'm seeing.
I have both of those settings set to false.
tonyhallett commentedon Jul 14, 2025
Then the sut assembly has likely not been included or the class itself has been excluded.
In the assembly with the class with only async methods are you receiving coverage for other classes ?
If you are using the option MsCodeCoverage - Yes and have not provided your own runsettings then you can check the generated .runsettings file within a sub directory of your test project's bin/Debug/../fine-code-coverage/coverage-tool-output
If not MsCodeCoverage then the FCC output window pane shows the command line arguments used to run the coverage.
You should check the FCC output window pane regardles.
If this is not sufficient for you to determine why you have no coverage then you need to provide a minimal reproducible solution that exhibits this behaviour and provide the FCC visual studio options that you have set.
tonyhallett commentedon Jul 14, 2025
Note that IncludeReferencedProjects is not transitive.
tonyhallett commentedon Jul 14, 2025
You need the pdb for the assembly you want covered. Are you running tests in debug or release ?
tonyhallett commentedon Jul 15, 2025
SolnWithCoverage.zip
slagesse-epic commentedon Jul 15, 2025
Thanks for the assistance. Your project does not compile for me without changing the signature of WhenAllAsync to
public async Task WhenAllAsync()After making that change, I am seeing the same behavior with your project.
Here is the project where I am producing this. I have two classes in the assembly under test, one that uses async methods and one that uses sync methods. The async class has source code showing as "not included' while the sync class is showing coverage as expected.
FCCBug.zip
Here is my FCC output including the generated runsettings file (note that I have redacted system path and user information):
fcc_output.txt
Here are my VS settings as screenshots (please let me know if there is a better way to export settings):
tonyhallett commentedon Jul 15, 2025
Perhaps this is the issue - from the readme
The old coverage was based upon every test. Ms code coverage is coverage from the tests you select in the test explorer.
slagesse-epic commentedon Jul 15, 2025
I am seeing this behavior even when asking the Test Explorer to run all tests.
tonyhallett commentedon Jul 15, 2025
I am out so will have a look later.
Can you screenshot the report and the editor colouring
slagesse-epic commentedon Jul 15, 2025
Here is the coverage report:
Here is the AsyncCalc class:
Here is the Calc class (Add is sync, Subtract is still async but is correctly showing as covered):
tonyhallett commentedon Jul 16, 2025
"I am seeing this behavior even when asking the Test Explorer to run all tests."
The AsyncTest class tests are not being run.
As you are using Microsoft.VisualStudio.TestTools.UnitTesting
slagesse-epic commentedon Jul 16, 2025
My apologies, the access level of AsyncCalc should be public and not internal. However, if I change AsyncCalc to public from internal, the tests run:
But I am still not seeing code coverage:
Here is the corrected solution:
FCCBug2.zip
tonyhallett commentedon Jul 16, 2025
I think the issue is with report generator not understanding the cobertura report that is generated from microsoft code coverage. Report generator is used for resolving names and producing the final cobertura report that FCC uses. Unfortunately with the version of report generator that FCC is currently using ( which cannot be changed easily as we are embedding their HTML report which is no longer supported in WebBroswer form ) this is indeed an issue and I apologize for being flippant before.
As a workaround you can set RunMsCodeCoverage No.
A better report that is up to date with report generator will be available soon.
tonyhallett commentedon Jul 16, 2025
https://github.com/danielpalme/ReportGenerator/releases/tag/v5.3.5
slagesse-epic commentedon Jul 16, 2025
Wonderful, thanks for the help and glad to hear a fix is on the way!