Skip to content

Commit

Permalink
Merge pull request #69 from tintoy/simplify-dispose
Browse files Browse the repository at this point in the history
  • Loading branch information
tintoy authored Sep 3, 2023
2 parents 8bf2288 + 7535d11 commit 95e67ea
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 118 deletions.
80 changes: 0 additions & 80 deletions src/LanguageServer.Common/DisposableObject.cs

This file was deleted.

41 changes: 3 additions & 38 deletions src/LanguageServer.Common/Utilities/ActivityCorrelationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,7 @@ public enum CorrelationSource
/// When the scope is disposed, the previous activity Id (if any) will be restored.
/// </remarks>
/// <seealso cref="ActivityCorrelationManager" />
public sealed class ActivityScope
: DisposableObject
public sealed class ActivityScope : IDisposable
{
/// <summary>
/// The current activity Id (if any).
Expand Down Expand Up @@ -228,42 +227,8 @@ internal ActivityScope(Guid? activityId = null, Guid? previousActivityId = null)
ActivityCorrelationManager.SynchronizeEventSourceActivityIds();
}

/// <summary>
/// The current activity Id (if any).
/// </summary>
public Guid? ActivityId
{
get
{
if (IsDisposed)
{
throw new ObjectDisposedException(GetType().Name);
}

return _activityId;
}
}

/// <summary>
/// The previous activity Id (if any).
/// </summary>
public Guid? PreviousActivityId
{
get
{
if (IsDisposed)
{
throw new ObjectDisposedException(GetType().Name);
}

return _previousActivityId;
}
}

/// <summary>
/// Dispose of resources being used by the object.
/// </summary>
protected override void Disposing()
/// <inheritdoc/>
public void Dispose()
{
// If the correlation manager does not have the expected activity Id, it's safer to not clean up.
if (ActivityCorrelationManager.CurrentActivityId == _activityId)
Expand Down

0 comments on commit 95e67ea

Please sign in to comment.