Skip to content

Allow to prevent RestoreOriginalModule when GetCoverageResult is called #577

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

Closed
wants to merge 2 commits into from

Conversation

shargon
Copy link

@shargon shargon commented Oct 3, 2019

There are specific situations when you want to preserve the Instrumentation. For example fuzzing techniques, we are working on an fuzzer using this library for the coverage and we need this change.

Thanks for your amazing work

@shargon
Copy link
Author

shargon commented Oct 3, 2019

For prevent the revert after the process die we use this

                var helper = (IInstrumentationHelper)DependencyInjection.Current.GetService(typeof(IInstrumentationHelper));

                var field = (ConcurrentDictionary<string, string>)helper
                    .GetType()
                    .GetField("_backupList", BindingFlags.Instance | BindingFlags.NonPublic)
                    .GetValue(helper);

                field.Clear();

There are an easier way?

@MarcoRossignoli MarcoRossignoli added the * NO MERGE * The PR is not ready for merge yet (see discussion for detailed reasons) label Oct 3, 2019
@MarcoRossignoli
Copy link
Collaborator

MarcoRossignoli commented Oct 3, 2019

Hi @shargon before go on with this we need to re-open discussion with @tonerdo @petli on future of core lib.
As you can see on this PR #566 we're discussing if has got sense expose a stable "core" functionality lib.
You can read some history on linked issue #566 (comment) #212

The issue with this kind of update is that are not "well structured" and "planned". I mean at the moment we don't guarantee core lib types stability(reason for hide everything) so we're concerned about take direct dependency on classes in these assembly.
We could break in future.

My idea was hide all and expose only public pertinent/stable object through interfaces/factories and be free to update internal implementation.

The only other way is a fork of coverlet...with all the risks for future synching.

@MarcoRossignoli
Copy link
Collaborator

@shargon to view instrumented asm you could use also msbuild #296 (comment)

@shargon
Copy link
Author

shargon commented Oct 3, 2019

If you don't expose a stable "core" nuget, you are killing some good ideas. Is possible with a fork yes, but have sense to do that?

@MarcoRossignoli
Copy link
Collaborator

If you don't expose a stable "core" nuget, you are killing some good ideas

cc: @tonerdo @petli

@MarcoRossignoli
Copy link
Collaborator

@shargon close this, because we'll start to shape public api.
Until that moment you'll need to clone and add a signature to your asm and adding to friendly asm on core lib. Let me know if you're in trouble.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
* 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