Skip to content

Commit e9ee3d0

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 3226be3 commit e9ee3d0

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
@@ -2199,11 +2199,11 @@ protected override Task<OperationResult<Value>> InvokeAsyncImpl ()
21992199
}
22002200
var tcs = new TaskCompletionSource<OperationResult<Value>> ();
22012201
invokeAsyncResult = (IInvokeAsyncResult)obj.BeginInvokeMethod (ctx.Thread, function, args, optionsToInvoke, ar => {
2202-
if (Token.IsCancellationRequested) {
2203-
tcs.SetCanceled ();
2204-
return;
2205-
}
22062202
try {
2203+
if (Token.IsCancellationRequested) {
2204+
tcs.SetCanceled ();
2205+
return;
2206+
}
22072207
var endInvokeResult = obj.EndInvokeMethodWithResult (ar);
22082208
tcs.SetResult (new SoftOperationResult (endInvokeResult.Result, false, endInvokeResult.OutArgs));
22092209
}

0 commit comments

Comments
 (0)