Skip to content

Results Not Available For Classes That Have Only async Methods #532

Open

Description

@slagesse-epic

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;
	}

}

Activity

  1. tonyhallett commented on Jul 14, 2025

    @tonyhallett
    Collaborator

    Albeit from a fork of FCC

    Image

    Have you turned off showing coverage when a class is fully covered ?

  2. tonyhallett commented on Jul 14, 2025

    @tonyhallett
    Collaborator

    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.

  3. slagesse-epic commented on Jul 14, 2025

    @slagesse-epic
    Author

    Hm, that's definitely not what I'm seeing.

    I have both of those settings set to false.

  4. tonyhallett commented on Jul 14, 2025

    @tonyhallett
    Collaborator

    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.

  5. tonyhallett commented on Jul 14, 2025

    @tonyhallett
    Collaborator

    Note that IncludeReferencedProjects is not transitive.

  6. tonyhallett commented on Jul 14, 2025

    @tonyhallett
    Collaborator

    You need the pdb for the assembly you want covered. Are you running tests in debug or release ?

  7. tonyhallett commented on Jul 15, 2025

    @tonyhallett
    Collaborator
  8. slagesse-epic commented on Jul 15, 2025

    @slagesse-epic
    Author

    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):

    Image Image Image Image Image Image
  9. tonyhallett commented on Jul 15, 2025

    @tonyhallett
    Collaborator

    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.

  10. slagesse-epic commented on Jul 15, 2025

    @slagesse-epic
    Author

    I am seeing this behavior even when asking the Test Explorer to run all tests.

  11. tonyhallett commented on Jul 15, 2025

    @tonyhallett
    Collaborator

    I am out so will have a look later.

    Can you screenshot the report and the editor colouring

  12. slagesse-epic commented on Jul 15, 2025

    @slagesse-epic
    Author

    Here is the coverage report:

    Image

    Here is the AsyncCalc class:

    Image

    Here is the Calc class (Add is sync, Subtract is still async but is correctly showing as covered):

    Image
  13. tonyhallett commented on Jul 16, 2025

    @tonyhallett
    Collaborator

    "I am seeing this behavior even when asking the Test Explorer to run all tests."

    The AsyncTest class tests are not being run.

    Image

    As you are using Microsoft.VisualStudio.TestTools.UnitTesting

    Image Image
  14. slagesse-epic commented on Jul 16, 2025

    @slagesse-epic
    Author

    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:

    Image

    But I am still not seeing code coverage:

    Image

    Here is the corrected solution:

    FCCBug2.zip

  15. tonyhallett commented on Jul 16, 2025

    @tonyhallett
    Collaborator

    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.

  16. slagesse-epic commented on Jul 16, 2025

    @slagesse-epic
    Author

    Wonderful, thanks for the help and glad to hear a fix is on the way!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions