diff --git a/src/Adapter/MSTest.Engine/Engine/TestExecutionContext.cs b/src/Adapter/MSTest.Engine/Engine/TestExecutionContext.cs
index 0f064cb973..1e36d5a376 100644
--- a/src/Adapter/MSTest.Engine/Engine/TestExecutionContext.cs
+++ b/src/Adapter/MSTest.Engine/Engine/TestExecutionContext.cs
@@ -55,7 +55,9 @@ public void ReportException(Exception exception, CancellationToken? timeoutCance
// We want to consider user timeouts as failures if they didn't use our cancellation token
OperationCanceledException canceledException
when canceledException.CancellationToken == _originalCancellationToken || canceledException.CancellationToken == CancellationToken
+#pragma warning disable CS0618 // Type or member is obsolete
=> new CancelledTestNodeStateProperty(ExceptionFlattener.FlattenOrUnwrap(exception)),
+#pragma warning restore CS0618 // Type or member is obsolete
OperationCanceledException canceledException when canceledException.CancellationToken == timeoutCancellationToken
=> new TimeoutTestNodeStateProperty(ExceptionFlattener.FlattenOrUnwrap(exception)),
AssertFailedException => new FailedTestNodeStateProperty(ExceptionFlattener.FlattenOrUnwrap(exception), exception.Message),
diff --git a/src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/AzureDevOpsReporter.cs b/src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/AzureDevOpsReporter.cs
index e9399f9899..e9122b9e1c 100644
--- a/src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/AzureDevOpsReporter.cs
+++ b/src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/AzureDevOpsReporter.cs
@@ -130,7 +130,9 @@ public async Task ConsumeAsync(IDataProducer dataProducer, IData value, Cancella
case ErrorTestNodeStateProperty error:
await WriteExceptionAsync(error.Explanation, error.Exception, cancellationToken).ConfigureAwait(false);
break;
+#pragma warning disable CS0618 // Type or member is obsolete
case CancelledTestNodeStateProperty cancelled:
+#pragma warning restore CS0618 // Type or member is obsolete
await WriteExceptionAsync(cancelled.Explanation, cancelled.Exception, cancellationToken).ConfigureAwait(false);
break;
case TimeoutTestNodeStateProperty timeout:
diff --git a/src/Platform/Microsoft.Testing.Extensions.HangDump/HangDumpActivityIndicator.cs b/src/Platform/Microsoft.Testing.Extensions.HangDump/HangDumpActivityIndicator.cs
index 636e6221cd..3ae365c81e 100644
--- a/src/Platform/Microsoft.Testing.Extensions.HangDump/HangDumpActivityIndicator.cs
+++ b/src/Platform/Microsoft.Testing.Extensions.HangDump/HangDumpActivityIndicator.cs
@@ -172,7 +172,9 @@ public async Task ConsumeAsync(IDataProducer dataProducer, IData value, Cancella
_testsCurrentExecutionState.TryAdd(nodeChangedMessage.TestNode.Uid, (nodeChangedMessage.TestNode.DisplayName, typeof(InProgressTestNodeStateProperty), _clock.UtcNow));
}
+#pragma warning disable CS0618 // Type or member is obsolete
else if (state is PassedTestNodeStateProperty or ErrorTestNodeStateProperty or CancelledTestNodeStateProperty
+#pragma warning restore CS0618 // Type or member is obsolete
or FailedTestNodeStateProperty or TimeoutTestNodeStateProperty or SkippedTestNodeStateProperty
&& _testsCurrentExecutionState.TryRemove(nodeChangedMessage.TestNode.Uid, out (string Name, Type Type, DateTimeOffset StartTime) record)
&& _traceLevelEnabled)
diff --git a/src/Platform/Microsoft.Testing.Extensions.MSBuild/MSBuildConsumer.cs b/src/Platform/Microsoft.Testing.Extensions.MSBuild/MSBuildConsumer.cs
index 1fac29da4b..41e8734c8f 100644
--- a/src/Platform/Microsoft.Testing.Extensions.MSBuild/MSBuildConsumer.cs
+++ b/src/Platform/Microsoft.Testing.Extensions.MSBuild/MSBuildConsumer.cs
@@ -125,7 +125,9 @@ await HandleFailuresAsync(
cancellationToken).ConfigureAwait(false);
break;
+#pragma warning disable CS0618 // Type or member is obsolete
case CancelledTestNodeStateProperty canceledState:
+#pragma warning restore CS0618 // Type or member is obsolete
await HandleFailuresAsync(
testNodeStateChanged.TestNode.DisplayName,
isCanceled: true,
diff --git a/src/Platform/Microsoft.Testing.Platform/Messages/TestNodeProperties.Categories.cs b/src/Platform/Microsoft.Testing.Platform/Messages/TestNodeProperties.Categories.cs
index 4ad215da6c..757b2862a4 100644
--- a/src/Platform/Microsoft.Testing.Platform/Messages/TestNodeProperties.Categories.cs
+++ b/src/Platform/Microsoft.Testing.Platform/Messages/TestNodeProperties.Categories.cs
@@ -19,7 +19,9 @@ internal static class TestNodePropertiesCategories
typeof(FailedTestNodeStateProperty),
typeof(ErrorTestNodeStateProperty),
typeof(TimeoutTestNodeStateProperty),
+#pragma warning disable CS0618 // Type or member is obsolete
typeof(CancelledTestNodeStateProperty),
+#pragma warning restore CS0618 // Type or member is obsolete
];
public static Type[] WellKnownTestNodeTestRunOutcomeFailedProperties { get; } =
@@ -27,6 +29,8 @@ internal static class TestNodePropertiesCategories
typeof(FailedTestNodeStateProperty),
typeof(ErrorTestNodeStateProperty),
typeof(TimeoutTestNodeStateProperty),
+#pragma warning disable CS0618 // Type or member is obsolete
typeof(CancelledTestNodeStateProperty),
+#pragma warning restore CS0618 // Type or member is obsolete
];
}
diff --git a/src/Platform/Microsoft.Testing.Platform/Messages/TestNodeProperties.cs b/src/Platform/Microsoft.Testing.Platform/Messages/TestNodeProperties.cs
index 1e3d4e1957..d05881112e 100644
--- a/src/Platform/Microsoft.Testing.Platform/Messages/TestNodeProperties.cs
+++ b/src/Platform/Microsoft.Testing.Platform/Messages/TestNodeProperties.cs
@@ -437,6 +437,7 @@ public override int GetHashCode()
///
/// Property that represents an eventual cancellation of a test node.
///
+[Obsolete("CancelledTestNodeStateProperty is obsolete. Test frameworks should throw OperationCanceledException using the cancellation token passed by Microsoft.Testing.Platform instead of using this state.")]
public sealed class CancelledTestNodeStateProperty : TestNodeStateProperty, IEquatable
{
///
diff --git a/src/Platform/Microsoft.Testing.Platform/OutputDevice/BrowserOutputDevice.cs b/src/Platform/Microsoft.Testing.Platform/OutputDevice/BrowserOutputDevice.cs
index d5f2415442..3b6c01edc6 100644
--- a/src/Platform/Microsoft.Testing.Platform/OutputDevice/BrowserOutputDevice.cs
+++ b/src/Platform/Microsoft.Testing.Platform/OutputDevice/BrowserOutputDevice.cs
@@ -356,7 +356,9 @@ public Task ConsumeAsync(IDataProducer dataProducer, IData value, CancellationTo
OnFailedTest(testNodeStateChanged, timeoutState, timeoutState.Exception, duration);
break;
+#pragma warning disable CS0618 // Type or member is obsolete
case CancelledTestNodeStateProperty cancelledState:
+#pragma warning restore CS0618 // Type or member is obsolete
OnFailedTest(testNodeStateChanged, cancelledState, cancelledState.Exception, duration);
break;
diff --git a/src/Platform/Microsoft.Testing.Platform/OutputDevice/TerminalOutputDevice.cs b/src/Platform/Microsoft.Testing.Platform/OutputDevice/TerminalOutputDevice.cs
index e689f41abf..c09ac428fe 100644
--- a/src/Platform/Microsoft.Testing.Platform/OutputDevice/TerminalOutputDevice.cs
+++ b/src/Platform/Microsoft.Testing.Platform/OutputDevice/TerminalOutputDevice.cs
@@ -460,7 +460,9 @@ public Task ConsumeAsync(IDataProducer dataProducer, IData value, CancellationTo
standardError);
break;
+#pragma warning disable CS0618 // Type or member is obsolete
case CancelledTestNodeStateProperty cancelledState:
+#pragma warning restore CS0618 // Type or member is obsolete
_terminalTestReporter.TestCompleted(
testNodeStateChanged.TestNode.Uid.Value,
testNodeStateChanged.TestNode.DisplayName,
diff --git a/src/Platform/Microsoft.Testing.Platform/ServerMode/DotnetTest/IPC/DotnetTestDataConsumer.cs b/src/Platform/Microsoft.Testing.Platform/ServerMode/DotnetTest/IPC/DotnetTestDataConsumer.cs
index 48cbb723f0..7ad8457c07 100644
--- a/src/Platform/Microsoft.Testing.Platform/ServerMode/DotnetTest/IPC/DotnetTestDataConsumer.cs
+++ b/src/Platform/Microsoft.Testing.Platform/ServerMode/DotnetTest/IPC/DotnetTestDataConsumer.cs
@@ -241,7 +241,9 @@ public async Task ConsumeAsync(IDataProducer dataProducer, IData value, Cancella
exceptions = FlattenToExceptionMessages(reason, timeoutTestNodeStateProperty.Exception);
break;
+#pragma warning disable CS0618 // Type or member is obsolete
case CancelledTestNodeStateProperty cancelledTestNodeStateProperty:
+#pragma warning restore CS0618 // Type or member is obsolete
state = TestStates.Cancelled;
duration = testNodeUpdateMessage.TestNode.Properties.SingleOrDefault()?.GlobalTiming.Duration.Ticks;
reason = nodeState.Explanation;
diff --git a/src/Platform/Microsoft.Testing.Platform/ServerMode/JsonRpc/Json/Json.cs b/src/Platform/Microsoft.Testing.Platform/ServerMode/JsonRpc/Json/Json.cs
index e2597d52b6..fe4e396cbb 100644
--- a/src/Platform/Microsoft.Testing.Platform/ServerMode/JsonRpc/Json/Json.cs
+++ b/src/Platform/Microsoft.Testing.Platform/ServerMode/JsonRpc/Json/Json.cs
@@ -248,7 +248,9 @@ public Json(Dictionary? serializers = null, Dictionary FailedState()
{
yield return [new FailedTestNodeStateProperty()];
yield return [new ErrorTestNodeStateProperty()];
+#pragma warning disable CS0618 // Type or member is obsolete
yield return [new CancelledTestNodeStateProperty()];
+#pragma warning restore CS0618 // Type or member is obsolete
yield return [new TimeoutTestNodeStateProperty()];
}