Skip to content

Commit c574f03

Browse files
committed
Move checking for cancelled token into try-catch to guarantee that UpdateSessionState() is invoked (in finally)
(cherry picked from commit 3befe19)
1 parent 0854104 commit c574f03

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Mono.Debugging.Soft/SoftDebuggerAdaptor.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -2231,11 +2231,11 @@ protected override Task<OperationResult<Value>> InvokeAsyncImpl ()
22312231
}
22322232
var tcs = new TaskCompletionSource<OperationResult<Value>> ();
22332233
invokeAsyncResult = (IInvokeAsyncResult)obj.BeginInvokeMethod (ctx.Thread, function, args, optionsToInvoke, ar => {
2234-
if (Token.IsCancellationRequested) {
2235-
tcs.SetCanceled ();
2236-
return;
2237-
}
22382234
try {
2235+
if (Token.IsCancellationRequested) {
2236+
tcs.SetCanceled ();
2237+
return;
2238+
}
22392239
var endInvokeResult = obj.EndInvokeMethodWithResult (ar);
22402240
tcs.SetResult (new SoftOperationResult (endInvokeResult.Result, false, endInvokeResult.OutArgs));
22412241
}

0 commit comments

Comments
 (0)