未验证 提交 28ca0fad 编写于 作者: T Tomáš Matoušek 提交者: GitHub

Merge pull request #45683 from tmat/CodeLensFix

Avoid SoftCrashException from CodeLens data point invalidation calls
......@@ -240,15 +240,15 @@ async Task InvalidateAsync(Task _)
return;
}
// fire and forget.
// ignore any exception such as rpc already disposed (disconnected)
_lastVersion = newVersion;
await _endPoint.InvokeAsync(
// fire and forget.
// ignore any exception such as rpc already disposed (disconnected)
// fire and forget:
_ = _endPoint.TryInvokeAsync(
nameof(IRemoteCodeLensDataPoint.Invalidate),
Array.Empty<object>(),
CancellationToken.None).ConfigureAwait(false);
_cancellationToken);
}
}
}
......
......@@ -119,6 +119,25 @@ public async Task InvokeAsync(string targetName, IReadOnlyList<object?> argument
}
}
public async Task TryInvokeAsync(string targetName, IReadOnlyList<object?> arguments, CancellationToken cancellationToken)
{
Contract.ThrowIfFalse(_startedListening);
if (_rpc.IsDisposed)
{
return;
}
try
{
await _rpc.InvokeWithCancellationAsync(targetName, arguments, cancellationToken).ConfigureAwait(false);
}
catch
{
// ignore
}
}
public async Task<T> InvokeAsync<T>(string targetName, IReadOnlyList<object?> arguments, CancellationToken cancellationToken)
{
Contract.ThrowIfFalse(_startedListening);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册