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

[Experiment]Expose coverlet.core.dll as nuget package #628

Closed

Conversation

MarcoRossignoli
Copy link
Collaborator

@MarcoRossignoli MarcoRossignoli commented Dec 2, 2019

Tackle #212

At the moment we can use coverlet in two main scenario:

  • Classic coverage tool, workflow :
  1. run instrumentation
  2. run code
  3. get coverage data
  • Real time coverage analysis
  1. run instrumentation
  2. inject coverlet inprocess and read real time coverage data
  3. get coverage data or simply close

You can checkout this branch and I did a complete working sample under Documentation/Examples/StandaloneUsage you can follow Readme.md in same folder to test by yourself.
Let me know if you're in trouble and if the api would be better.

cc possible interested guys @ppumkin @shargon @singhsarab @jnovick @vagisha-nidhi @acesiddhu @karanjitsingh @sharwell

cc: @tonerdo @petli

Video sample https://twitter.com/MarcoRossignoli/status/1201546945589841922

@MarcoRossignoli MarcoRossignoli added * NO MERGE * The PR is not ready for merge yet (see discussion for detailed reasons) feature-request New feature request discussion Generic discussion on something labels Dec 2, 2019
@MarcoRossignoli MarcoRossignoli changed the title Expose coverlet.core.dll as nuget package [WIP]Expose coverlet.core.dll as nuget package Dec 3, 2019
Copy link
Collaborator

@petli petli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just one thought about controlling the lifetime of instrumented files.

IInProcessCoverageEngine CreateInProcessEngine(Stream instrumentationResultStream);
}

public interface ICoverageEngine
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be IDisposable instead and clean up the instrumented files on dispose? It would let the calling code control when it happens instead of it being done on process exit.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clean up the instrumented files

You mean "restore non instrumented ones"?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes :)

Copy link
Collaborator Author

@MarcoRossignoli MarcoRossignoli Dec 10, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be possible...I need to check how much code update...but I think that we could inject a slighly different instrumenterhelper that doesn't fire restore on process exits, I'll take a look, thank's.
This could be good also for "fire and forget" instrumentation, where we don't mind about dirty asm on target dir, and instrumentor process can die after instrument.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The latter is also a good tool to look at instrumented files themselves. Could be an enum on InstrumenterOptions when calling ICoverageEngineFactory.CreateEngine:

enum RestoreInstrumentedModules
{
       OnProcessExit,
       OnEngineDispose,
       Never
 }

It would mean that ICoverageEngine still need to be IDisposable, even if it is only cleans up resources in some cases.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll try to add this feat.

@MarcoRossignoli MarcoRossignoli changed the title [WIP]Expose coverlet.core.dll as nuget package [Experiment]Expose coverlet.core.dll as nuget package Mar 7, 2021
@MarcoRossignoli
Copy link
Collaborator Author

Closing for now, we'll take some inspiration in future when we'll decide to expose instrumentation engine.

@MarcoRossignoli MarcoRossignoli deleted the publicapi branch October 29, 2021 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Generic discussion on something feature-request New feature request * NO MERGE * The PR is not ready for merge yet (see discussion for detailed reasons)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants