-
Notifications
You must be signed in to change notification settings - Fork 389
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
Inject InstrumentationHelper #531
Conversation
@@ -6,7 +6,7 @@ | |||
|
|||
namespace Coverlet.Core | |||
{ | |||
internal static class DependencyInjection | |||
public static class DependencyInjection |
There was a problem hiding this comment.
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()); |
There was a problem hiding this comment.
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?
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
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