Repository: dotnet/roslyn
File: src/Compilers/Core/Portable/Operations/ControlFlowGraphBuilder.InterpolatedStringContext.cs (C#)

Code before:
                MaximumStackDepth = maximumStackDepth;
                OutPlaceholder = outParameterPlaceholder;
                HandlerPlaceholder = handlerPlaceholder;
            }
        }

        [Conditional("DEBUG")]
        [MemberNotNull(nameof(_currentInterpolatedStringHandlerCreationContext))]
        private void AssertContainingContextIsForThisCreation(IOperation placeholderOperation, bool assertArgumentContext)
        {
            Debug.Assert(_currentInterpolatedStringHandlerCreationContext != null);
            Debug.Assert(placeholderOperation is IInstanceReferenceOperation { ReferenceKind: InstanceReferenceKind.InterpolatedStringHandler } or IInterpolatedStringHandlerArgumentPlaceholderOperation);

            IOperation? operation = placeholderOperation.Parent;
            while (operation is not (null or IInterpolatedStringHandlerCreationOperation))
            {
                operation = operation.Parent;
            }

            Debug.Assert(operation != null);
            Debug.Assert(_currentInterpolatedStringHandlerCreationContext.ApplicableCreationOperation == operation);

            // Note: _currentInterpolatedStringHandlerArgumentContext may be null in error scenarios
            // (for example, indexer with no setter in object initializer where the handler creation is visited
            // as a child of an InvalidOperation rather than through VisitAndPushArguments).
            // If a new test triggers this assert because the a different ancestor has the error, it will likely be fine to just add
            // that case to the assert.
            if (assertArgumentContext)
            {
                if (_currentInterpolatedStringHandlerArgumentContext != null)
                {
                    Debug.Assert(_currentInterpolatedStringHandlerArgumentContext.ApplicableCreationOperations.Contains((IInterpolatedStringHandlerCreationOperation)operation));
                }
                else
                {
                    Debug.Assert(placeholderOperation.Parent!.Parent is IObjectCreationOperation objectCreation && objectCreation.HasErrors(_compilation));
                }
            }
        }
    }
}


Review comment (suggestion):
Not blocking
```suggestion
            // If a new test triggers this assert because a different ancestor has the error, it will likely be fine to just add
```

Code after:
                MaximumStackDepth = maximumStackDepth;
                OutPlaceholder = outParameterPlaceholder;
                HandlerPlaceholder = handlerPlaceholder;
            }
        }

        [Conditional("DEBUG")]
        [MemberNotNull(nameof(_currentInterpolatedStringHandlerCreationContext))]
        private void AssertContainingContextIsForThisCreation(IOperation placeholderOperation, bool assertArgumentContext)
        {
            Debug.Assert(_currentInterpolatedStringHandlerCreationContext != null);
            Debug.Assert(placeholderOperation is IInstanceReferenceOperation { ReferenceKind: InstanceReferenceKind.InterpolatedStringHandler } or IInterpolatedStringHandlerArgumentPlaceholderOperation);

            IOperation? operation = placeholderOperation.Parent;
            while (operation is not (null or IInterpolatedStringHandlerCreationOperation))
            {
                operation = operation.Parent;
            }

            Debug.Assert(operation != null);
            Debug.Assert(_currentInterpolatedStringHandlerCreationContext.ApplicableCreationOperation == operation);

            // Note: _currentInterpolatedStringHandlerArgumentContext may be null in error scenarios
            // (for example, indexer with no setter in object initializer where the handler creation is visited
            // as a child of an InvalidOperation rather than through VisitAndPushArguments).
            // If a new test triggers this assert because a different ancestor has the error, it will likely be fine to just add
            // that case to the assert.
            if (assertArgumentContext)
            {
                if (_currentInterpolatedStringHandlerArgumentContext != null)
                {
                    Debug.Assert(_currentInterpolatedStringHandlerArgumentContext.ApplicableCreationOperations.Contains((IInterpolatedStringHandlerCreationOperation)operation));
                }
                else
                {
                    Debug.Assert(placeholderOperation.Parent!.Parent is IObjectCreationOperation objectCreation && objectCreation.HasErrors(_compilation));
                }
            }
        }
    }
}