Hi, I've got a question regarding the async APIs in Roslyn: is it allowed to have multiple outstanding calls to async methods?
I'm facing is with the following code:
var markerTask = ScriptEditorUtilities.GetClassifiedSpansAsync(document, codeSpan);
var errorTask = ScriptEditorUtilities.GetDiagnosticsAsync(document);
// do other stuff ...
var markers = await markerTask.ConfigureAwait(true);
var errors = await errorTask.ConfigureAwait(true);
GetClassifiedSpansAsync calls Classifier.GetClassifiedSpansAsync() and GetDiagnosticsAsync calls Document.GetSemanticModelAsync().GetDiagnostics()
The calls are made from the WinForms UI Thread, but internally Roslyn sometimes (about 1 in 30 runs) will throw exceptions while loading an assembly because it (internally) is using the same FileStream from multiple threads without proper synchronization.
So the question: did I miss some guideline that only one async method can be outstanding? Or is this a bug inside Roslyn?