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

Bug: Unsubscribing from DiagnosticSource events does not work #72

Closed
gregkalapos opened this issue Jan 21, 2019 · 2 comments
Closed

Bug: Unsubscribing from DiagnosticSource events does not work #72

gregkalapos opened this issue Jan 21, 2019 · 2 comments
Assignees

Comments

@gregkalapos
Copy link
Contributor

This is more pressuring for writing tests.

Currently code like this does not unsubscribe the agent from receiving events and creating spans:

using (agent.Subscribe(new HttpDiagnosticsSubscriber()))
{
	//do stuff			
}
//we should not be subscribed here, but we are.

Therefore subsequent tests that assume the HttpDiagnosticsSubscriber is not registered will fail.

@gregkalapos gregkalapos self-assigned this Jan 21, 2019
@gregkalapos
Copy link
Contributor Author

The root cause was in DiagnosticInitializer.cs:

public void OnNext(DiagnosticListener value)
{
   foreach (var listener in _listeners)
   {
      if (value.Name == listener.Name) value.Subscribe(listener);
   }
}

value.Subscribe returns IDisposable which wasn't disposed. Fix is on the way.

@gregkalapos
Copy link
Contributor Author

Fixed by #75

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

No branches or pull requests

1 participant