public async Task <object> Get(AsyncExprCtx ae) { var s = sema; if (s != null) { if (s == errFlag) { throw (Exception)value; } await s.WaitAsync(ae.Cancellation); try { if (sema != null) { // enter here only once if (sema == errFlag) { throw (Exception)value; } try { value = await OPs.VectorValueOf(ae, value); sema = null; } catch (OperationCanceledException) { throw; } catch (Exception ex) { value = ex; var tmp = sema; sema = errFlag; //tmp.Dispose(); throw; } } } finally { s.Release(); } } return(value); }