I've read a few of the articles on Span<T> (and ReadOnlySpan<T>) and how they musn't be used in async methods.
There was a great Chanel 9 video by Jared Parsons where he showed the following example:
static async Task<bool> IsCSharpIdentifierAsync(Memory<char> memory, StreamReader reader)
{
var count = await reader.ReadAsync(memory);
return IsCSharpIdentifier(memory.Span.Slice(0, count));
}
static bool IsCSharpIdentifier(ReadOnlySpan<char> value)
{
....
}
So, the overall flow might be asynchronous, but we're okay if we call out to a synchronous method that uses the Span.
Now, I've little if any knowledge about compilation, but I understand that the compiler might (in certain instances) "in-line" methods (i.e. copy the code from the called method into the calling method) to reduce the overhead of the method call.
I'm guessing the answer is "snort...of course not", but is there any chance that the compiler might inline a method using a Span into an async method? If so, that would lead to problems as I understand it.... (This includes "local methods")