“finally” not executed because of Async in “try”?
问题 I have a bool ( b ) which appears only twice in my code (besides its declaration): try { b = true; //code including await SomeAsync(); } catch { } finally { b = false; } yet sometimes the try block is started with b being true (- before b = true ) which should never be happening because the declaration leaves it false , as does the previous finally . At some point, this code is executed in a loop, which in some cases is iterating quickly and SomeAsync() is trying to use too much memory. I