From a49dd6c891f90c65480f8f4753c5622053dbcd91 Mon Sep 17 00:00:00 2001 From: Martin Costello Date: Wed, 31 Jul 2024 17:08:54 +0100 Subject: [PATCH 1/2] Add [DebuggerDisplay] to CancellationTokenSource Add `[DebuggerDisplay]` to `CancellationTokenSource` to show whether cancelled or disposed. Relates to #105698. --- .../src/System/Threading/CancellationTokenSource.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/CancellationTokenSource.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/CancellationTokenSource.cs index 26c2eb7078598..44a6a44e3d853 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/CancellationTokenSource.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/CancellationTokenSource.cs @@ -22,6 +22,7 @@ namespace System.Threading /// concurrently from multiple threads. /// /// + [DebuggerDisplay("IsCancellationRequested = {IsCancellationRequested}; Disposed = {_disposed}")] public class CancellationTokenSource : IDisposable { /// A that's already canceled. From b1f4d5de346364a8c1969005f461e4ef06741380 Mon Sep 17 00:00:00 2001 From: Stephen Toub Date: Thu, 1 Aug 2024 07:55:43 -0400 Subject: [PATCH 2/2] Update src/libraries/System.Private.CoreLib/src/System/Threading/CancellationTokenSource.cs --- .../src/System/Threading/CancellationTokenSource.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/CancellationTokenSource.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/CancellationTokenSource.cs index 44a6a44e3d853..7ea36b67c970b 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/CancellationTokenSource.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/CancellationTokenSource.cs @@ -22,7 +22,7 @@ namespace System.Threading /// concurrently from multiple threads. /// /// - [DebuggerDisplay("IsCancellationRequested = {IsCancellationRequested}; Disposed = {_disposed}")] + [DebuggerDisplay("IsCancellationRequested = {IsCancellationRequested}")] public class CancellationTokenSource : IDisposable { /// A that's already canceled.