From dd715a0747ebeb85a234c8abec7e01bb6652c8ce Mon Sep 17 00:00:00 2001 From: Stephen Toub Date: Wed, 7 Jun 2023 15:43:49 -0400 Subject: [PATCH] Tweak assert in AsyncTaskMethodBuilder (#87215) --- .../System/Runtime/CompilerServices/AsyncTaskMethodBuilderT.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncTaskMethodBuilderT.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncTaskMethodBuilderT.cs index 786eaecf709cf2..443b8993612a56 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncTaskMethodBuilderT.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncTaskMethodBuilderT.cs @@ -333,7 +333,7 @@ public ref ExecutionContext? Context { get { - Debug.Assert(m_stateObject is null || m_stateObject is ExecutionContext, $"{nameof(m_stateObject)} must only be for ExecutionContext but contained {m_stateObject}."); + Debug.Assert(m_stateObject is null or ExecutionContext, $"Expected {nameof(m_stateObject)} to be null or an ExecutionContext but was {(m_stateObject is object o ? o.GetType().ToString() : "(null)")}."); return ref Unsafe.As(ref m_stateObject); } }