Skip to content

Inject InstrumentationHelper #531

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 7 commits into from
Sep 10, 2019

Conversation

MarcoRossignoli
Copy link
Collaborator

@MarcoRossignoli MarcoRossignoli commented Sep 4, 2019

I'm working on #529 and I need to inject an IFilesystem service to instrumentation helper so simulate a missing source files.
To do that I need to move InstrumentationHelper class from static to instance, in this way we can also test a core part o coverlet, the instrumentation helper.

contributes also to #387

cc: @tonerdo @petli

@@ -6,7 +6,7 @@

namespace Coverlet.Core
{
internal static class DependencyInjection
public static class DependencyInjection
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The only thing I need to do is to expose container to be used by console/task/collector without expose internal implementation.

{
DependencyInjection.Current.GetService<IProcessExitHandler>().Add((s, e) => RestoreOriginalModules());
processExitHandler.Add((s, e) => RestoreOriginalModules());
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@ViktorHofer you did this change, now a single instance of InstrumentationHelper will be returned by "static" container(singleton) so the delegate will keep object alive for "restore".
Is it ok for you or do you see some issue with it?

@MarcoRossignoli MarcoRossignoli added the enhancement General enhancement request label Sep 4, 2019
@MarcoRossignoli
Copy link
Collaborator Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@MarcoRossignoli MarcoRossignoli merged commit 1bb08bb into coverlet-coverage:master Sep 10, 2019
@MarcoRossignoli MarcoRossignoli deleted the externalpdb branch September 10, 2019 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement General enhancement request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant