提交 bb9ac8a7 编写于 作者: C CyrusNajmabadi

Merge remote-tracking branch 'upstream/master' into addPackageRollback

......@@ -6689,7 +6689,7 @@ fourth]]>)
End Sub
<Fact(Skip:="https://github.com/dotnet/roslyn/issues/13277")>
<Fact()>
<WorkItem(13277, "https://github.com/dotnet/roslyn/issues/13277")>
Public Sub CreateTupleTypeSymbol_UnderlyingTypeIsError()
......@@ -6698,9 +6698,7 @@ fourth]]>)
Dim intType As TypeSymbol = comp.GetSpecialType(SpecialType.System_Int32)
Dim vt2 = comp.CreateErrorTypeSymbol(Nothing, "ValueTuple", 2).Construct(intType, intType)
Dim tuple = comp.CreateTupleTypeSymbol(vt2, Nothing)
' Crashes in IsTupleCompatible
Assert.Throws(Of ArgumentException)(Function() comp.CreateTupleTypeSymbol(underlyingType:=vt2))
End Sub
<Fact>
......
......@@ -41,32 +41,86 @@ internal class JsonRpcSession : RemoteHostClient.Session
_cancellationRegistration = CancellationToken.Register(Dispose);
}
public override Task InvokeAsync(string targetName, params object[] arguments)
public override async Task InvokeAsync(string targetName, params object[] arguments)
{
CancellationToken.ThrowIfCancellationRequested();
return _serviceClient.InvokeAsync(targetName, arguments.Concat(PinnedScope.SolutionChecksum.ToArray()).ToArray());
try
{
await _serviceClient.InvokeAsync(
targetName, arguments.Concat(PinnedScope.SolutionChecksum.ToArray()).ToArray()).ConfigureAwait(false);
}
catch (ObjectDisposedException)
{
// object disposed exception can be thrown from StreamJsonRpc if JsonRpc is disposed in the middle of read/write.
// the way we added cancellation support to the JsonRpc which doesn't support cancellation natively
// can cause this exception to happen. newer version supports cancellation token natively, but
// we can't use it now, so we will catch object disposed exception and check cancellation token
CancellationToken.ThrowIfCancellationRequested();
throw;
}
}
public override Task<T> InvokeAsync<T>(string targetName, params object[] arguments)
public override async Task<T> InvokeAsync<T>(string targetName, params object[] arguments)
{
CancellationToken.ThrowIfCancellationRequested();
return _serviceClient.InvokeAsync<T>(targetName, arguments.Concat(PinnedScope.SolutionChecksum.ToArray()).ToArray());
try
{
return await _serviceClient.InvokeAsync<T>(
targetName, arguments.Concat(PinnedScope.SolutionChecksum.ToArray()).ToArray()).ConfigureAwait(false);
}
catch (ObjectDisposedException)
{
// object disposed exception can be thrown from StreamJsonRpc if JsonRpc is disposed in the middle of read/write.
// the way we added cancellation support to the JsonRpc which doesn't support cancellation natively
// can cause this exception to happen. newer version supports cancellation token natively, but
// we can't use it now, so we will catch object disposed exception and check cancellation token
CancellationToken.ThrowIfCancellationRequested();
throw;
}
}
public override Task InvokeAsync(string targetName, IEnumerable<object> arguments, Func<Stream, CancellationToken, Task> funcWithDirectStreamAsync)
public override async Task InvokeAsync(string targetName, IEnumerable<object> arguments, Func<Stream, CancellationToken, Task> funcWithDirectStreamAsync)
{
CancellationToken.ThrowIfCancellationRequested();
return _serviceClient.InvokeAsync(targetName, arguments.Concat(PinnedScope.SolutionChecksum.ToArray()).ToArray(), funcWithDirectStreamAsync, CancellationToken);
try
{
await _serviceClient.InvokeAsync(
targetName, arguments.Concat(PinnedScope.SolutionChecksum.ToArray()).ToArray(),
funcWithDirectStreamAsync, CancellationToken).ConfigureAwait(false);
}
catch (ObjectDisposedException)
{
// object disposed exception can be thrown from StreamJsonRpc if JsonRpc is disposed in the middle of read/write.
// the way we added cancellation support to the JsonRpc which doesn't support cancellation natively
// can cause this exception to happen. newer version supports cancellation token natively, but
// we can't use it now, so we will catch object disposed exception and check cancellation token
CancellationToken.ThrowIfCancellationRequested();
throw;
}
}
public override Task<T> InvokeAsync<T>(string targetName, IEnumerable<object> arguments, Func<Stream, CancellationToken, Task<T>> funcWithDirectStreamAsync)
public override async Task<T> InvokeAsync<T>(string targetName, IEnumerable<object> arguments, Func<Stream, CancellationToken, Task<T>> funcWithDirectStreamAsync)
{
CancellationToken.ThrowIfCancellationRequested();
return _serviceClient.InvokeAsync<T>(targetName, arguments.Concat(PinnedScope.SolutionChecksum.ToArray()).ToArray(), funcWithDirectStreamAsync, CancellationToken);
try
{
return await _serviceClient.InvokeAsync<T>(
targetName, arguments.Concat(PinnedScope.SolutionChecksum.ToArray()).ToArray(),
funcWithDirectStreamAsync, CancellationToken).ConfigureAwait(false);
}
catch (ObjectDisposedException)
{
// object disposed exception can be thrown from StreamJsonRpc if JsonRpc is disposed in the middle of read/write.
// the way we added cancellation support to the JsonRpc which doesn't support cancellation natively
// can cause this exception to happen. newer version supports cancellation token natively, but
// we can't use it now, so we will catch object disposed exception and check cancellation token
CancellationToken.ThrowIfCancellationRequested();
throw;
}
}
protected override void OnDisposed()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册