Skip to content

Add System.Private.CoreLib support #209

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

Merged
merged 3 commits into from
Oct 14, 2018

Conversation

pjanotti
Copy link
Contributor

@pjanotti pjanotti commented Oct 4, 2018

This is a special case needed to make coverlet the official code coverage tool on CoreFx repo (see https://github.com/dotnet/corefx/issues/31281).

The change didn't cause any noticeable performance penalty and basically has a custom "metada importer processor" to deal with System.Private.CoreLib.

@codecov
Copy link

codecov bot commented Oct 5, 2018

Codecov Report

Merging #209 into master will decrease coverage by 0.11%.
The diff coverage is 90.9%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #209      +/-   ##
==========================================
- Coverage   95.03%   94.91%   -0.12%     
==========================================
  Files          15       15              
  Lines        1590     1633      +43     
==========================================
+ Hits         1511     1550      +39     
- Misses         79       83       +4
Impacted Files Coverage Δ
src/coverlet.core/Instrumentation/Instrumenter.cs 98.92% <90.9%> (-1.08%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 967c180...e808d16. Read the comment docs.

@pjanotti
Copy link
Contributor Author

pjanotti commented Oct 5, 2018

😃 nice report! I can't actually test this e2e (requires a copy IL of System.Private.CoreLib and then running the instrumented version). However, I can add a test to cover the type added to the code by faking a dll as being named System.Private.CoreLib...

@tonerdo
Copy link
Collaborator

tonerdo commented Oct 5, 2018

@pjanotti don't worry about the coverage result right now. I don't enforce a threshold and 94% is still pretty good! Will review this PR over the weekend

@ViktorHofer
Copy link
Contributor

@tonerdo have you had time to look into the changes? We really would like to use them in corefx as soon as possible :)

@tonerdo
Copy link
Collaborator

tonerdo commented Oct 9, 2018

@ViktorHofer will take a look later today. Been busy attending to some personal affairs

@tonerdo
Copy link
Collaborator

tonerdo commented Oct 11, 2018

@pjanotti apologies for taking so long to get to this. I've looked through it and nothing jumps out at me. However, I'm a bit concerned that we have to create a provision for this in the core library. But looking at it again I feel I can make this single allowance since it's for an integral part of .NET Core.

Out of curiosity why didn't #181 fix dotnet/corefx#31281?

@pjanotti
Copy link
Contributor Author

pjanotti commented Oct 12, 2018

Good question @tonerdo: the issue is that System.Private.CoreLib can't reference any external assembly and the tracker template is injected, intentionally, by referencing netstandard. This allows it (at least in theory) to instrument assemblies running against any runtime that supports netstandard. All the code used by the tracker template is part of System.Private.CoreLib so what this change does is that it ensures that no actual reference is made via netstandard.

Unfortunately I didn't see a way to avoid this special case. That said it in principle can be used against any "corlib" that can't reference external assemblies (as long as the "corlib" contains the types used by the tracker template).

@tonerdo tonerdo merged commit 3a3cb5a into coverlet-coverage:master Oct 14, 2018
@tonerdo
Copy link
Collaborator

tonerdo commented Oct 14, 2018

Thanks for this @pjanotti, will make a new release tomorrow and notify you once that happens

NorekZ pushed a commit to NorekZ/coverlet that referenced this pull request Nov 8, 2018
@pjanotti pjanotti deleted the corelib.support branch December 7, 2019 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants