-
Notifications
You must be signed in to change notification settings - Fork 292
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
[Shared] Fix analysis warnings #953
[Shared] Fix analysis warnings #953
Conversation
@@ -87,11 +89,11 @@ public void OnError(Exception error) | |||
/// <inheritdoc/> | |||
public void Dispose() | |||
{ | |||
this.Dispose(true); | |||
this.DisposeInternal(); |
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.
nit: Just FYI in a sealed class you can slim down the disposal pattern. This would be fine:
public void Dispose()
{
if (Interlocked.CompareExchange(ref this.disposed, 1, 0) == 1)
{
return;
}
lock (this.listenerSubscriptions)
{
foreach (var listenerSubscription in this.listenerSubscriptions)
{
listenerSubscription?.Dispose();
}
this.listenerSubscriptions.Clear();
}
this.allSourcesSubscription?.Dispose();
this.allSourcesSubscription = null;
}
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #953 +/- ##
==========================================
- Coverage 69.39% 68.95% -0.44%
==========================================
Files 200 199 -1
Lines 7636 7589 -47
==========================================
- Hits 5299 5233 -66
- Misses 2337 2356 +19
|
Fix/suppress code analysis warnings in OpenTelemetry.Contrib.Shared. Contributes to #950.
Apply code review feedback and put the code to dispose inline.
Changes
Fix/suppress code analysis warnings in OpenTelemetry.Contrib.Shared.
Contributes to #950.