diff --git a/src/DotNext.Metaprogramming/Runtime/CompilerServices/AsyncStateMachineBuilder.cs b/src/DotNext.Metaprogramming/Runtime/CompilerServices/AsyncStateMachineBuilder.cs index e76b71c49..b7aa4ff01 100644 --- a/src/DotNext.Metaprogramming/Runtime/CompilerServices/AsyncStateMachineBuilder.cs +++ b/src/DotNext.Metaprogramming/Runtime/CompilerServices/AsyncStateMachineBuilder.cs @@ -2,7 +2,6 @@ using System.Diagnostics.CodeAnalysis; using System.Linq.Expressions; using System.Runtime.CompilerServices; -using static System.Diagnostics.Debug; using static System.Linq.Enumerable; namespace DotNext.Runtime.CompilerServices; @@ -457,7 +456,7 @@ private static MemberExpression GetStateField(ParameterExpression stateMachine) private Expression Build(LambdaExpression stateMachineMethod) { - Assert(stateMachine is not null); + Debug.Assert(stateMachine is not null); var stateVariable = Expression.Variable(GetStateField(stateMachine).Type); var parameters = methodBuilder.Parameters; ICollection newBody = new LinkedList(); @@ -550,7 +549,7 @@ private static MemberExpression[] CreateStateHolderType(Type returnType, bool us slots = builder.Build(sm.Build, out _); } - Assert(sm.StateMachine is not null); + Debug.Assert(sm.StateMachine is not null); stateMachine = sm.StateMachine; return slots; } @@ -583,7 +582,7 @@ protected override Expression VisitParameter(ParameterExpression node) protected override Expression VisitExtension(Expression node) { - Assert(stateMachine is not null); + Debug.Assert(stateMachine is not null); return node switch { StatePlaceholderExpression placeholder => placeholder.Reduce(),