Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when using multiple referenced libraries #8

Closed
neurospeech opened this issue Mar 22, 2018 · 6 comments
Closed

Error when using multiple referenced libraries #8

neurospeech opened this issue Mar 22, 2018 · 6 comments
Labels
bug Something isn't working

Comments

@neurospeech
Copy link

Lets say we have 3 projects.

Library
   |
   +--(Referenced by) Application
            |
            +--(Referenced by) Tests

In AppData\Temp, coverage is generated for "Application" but not for "Library", or even if it is generated, it fails with an error that could not find Library_SOME_GUID file. But there are multiple Application_SOME_GUID files in AppData\Temp.

I suspect, Library_SOME_GUID is written as Application_SOME_GUID

@tonerdo
Copy link
Collaborator

tonerdo commented Mar 22, 2018

I'll take a look shortly and try to fix it.

@jbright
Copy link

jbright commented Mar 22, 2018

I think that's the same issue I'm having.

@wlmiller
Copy link
Contributor

I was having the same issue so I dug in to see what I could find - I believe it's actually two issues.

  1. If the module is never hit by a test, CoverageTracker.MarkExecuted isn't called for that module and no hits file is created (this would be addressed by @jbright's PR).
  2. CoverageTracker has a single static _path and a single list of _markers, which means that all the hits get written to the same file. So even if you have hits across multiple modules, they all get dumped into one file at the end.

This fixed it for me - https://github.com/wlmiller/coverlet/commit/c9e9afb835cb25dfe006c82851fc6dcb99810703. I'm happy to submit a PR but didn't want to step on the existing PR for this issue since it's still open.

@tonerdo
Copy link
Collaborator

tonerdo commented Mar 23, 2018

@wlmiller by all means I'll love to have that PR, thanks for pointing out the issue.
You can just remove this line if (!File.Exists(result.HitsFilePath)) { continue; } if you're concerned about stepping on the existing PR and I also have my reservations about it

@tonerdo
Copy link
Collaborator

tonerdo commented Mar 24, 2018

This has been fixed in #14. New NuGet bits drop by Monday

@tonerdo
Copy link
Collaborator

tonerdo commented Mar 24, 2018

@wlmiller did some tests locally and found out that the implementation of CoverageTracker.MarkExecuted wasn't thread-safe from the onset. Your change simply brought that to light, here's the fix if you're interested c055f95

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants