diff --git a/src/Adapter/MSTest.TestAdapter/Extensions/ExceptionExtensions.cs b/src/Adapter/MSTest.TestAdapter/Extensions/ExceptionExtensions.cs
index 67d14e8b73..318320906b 100644
--- a/src/Adapter/MSTest.TestAdapter/Extensions/ExceptionExtensions.cs
+++ b/src/Adapter/MSTest.TestAdapter/Extensions/ExceptionExtensions.cs
@@ -41,7 +41,7 @@ internal static Exception GetRealException(this Exception exception)
///
/// An object.
/// Exception message.
- internal static string TryGetMessage(this Exception exception)
+ internal static string TryGetMessage(this Exception? exception)
{
if (exception == null)
{