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

Remove unnecessary assertion that CancellationSeries is disposed #58426

Merged
merged 1 commit into from
Dec 20, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions src/Workspaces/Core/Portable/Utilities/CancellationSeries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
// reference implementation.

using System;
#if DEBUG
using System.Diagnostics;
#endif
using System.Threading;

namespace Roslyn.Utilities
Expand Down Expand Up @@ -42,22 +39,7 @@ public CancellationSeries(CancellationToken token = default)
_cts.Cancel();

_superToken = token;

#if DEBUG
_ctorStack = new StackTrace();
#endif
}

#if DEBUG
private readonly StackTrace _ctorStack;

~CancellationSeries()
{
Contract.ThrowIfFalse(
Environment.HasShutdownStarted || _cts == null,
$"Instance of CancellationSeries not disposed before being finalized{Environment.NewLine}Stack at construction:{Environment.NewLine}{_ctorStack}");
}
#endif

/// <summary>
/// Determines if the cancellation series has an active token which has not been cancelled.
Expand Down Expand Up @@ -131,10 +113,6 @@ public CancellationToken CreateNext(CancellationToken token = default)

public void Dispose()
{
#if DEBUG
GC.SuppressFinalize(this);
#endif

var source = Interlocked.Exchange(ref _cts, null);

if (source == null)
Expand Down