Span<T> is stack-only.
Once you await, the stack frame is gone.
❌ This breaks
Span<byte> buffer = stackalloc byte[256]; await DoAsync(buffer); // 💥
✅ Correct
Memory<byte> buffer = new byte[256]; await DoAsync(buffer);
Rule:
-
Span<T>→ sync, hot paths -
Memory<T>→ async-safe
