Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
57759e39
R
roslyn
项目概览
lwm1986
/
roslyn
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roslyn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
57759e39
编写于
9月 30, 2020
作者:
S
Sam Harwell
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Do not cancel operations after point of no return
上级
24bcf13a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
19 addition
and
4 deletion
+19
-4
src/Workspaces/Remote/Core/BrokeredServiceConnection.cs
src/Workspaces/Remote/Core/BrokeredServiceConnection.cs
+7
-2
src/Workspaces/Remote/Core/RemoteHostAssetSerialization.cs
src/Workspaces/Remote/Core/RemoteHostAssetSerialization.cs
+6
-1
src/Workspaces/Remote/Core/SolutionAssetProvider.cs
src/Workspaces/Remote/Core/SolutionAssetProvider.cs
+6
-1
未找到文件。
src/Workspaces/Remote/Core/BrokeredServiceConnection.cs
浏览文件 @
57759e39
...
...
@@ -150,6 +150,11 @@ public override async ValueTask<Optional<TResult>> TryInvokeAsync<TResult>(Solut
Func
<
PipeReader
,
CancellationToken
,
ValueTask
<
TResult
>>
reader
,
CancellationToken
cancellationToken
)
{
// We can cancel at entry, but once the pipe operations are scheduled we rely on both operations running to
// avoid deadlocks (the exception handler in 'writerTask' ensures progress is made in 'readerTask').
cancellationToken
.
ThrowIfCancellationRequested
();
var
mustNotCancelToken
=
CancellationToken
.
None
;
var
pipe
=
new
Pipe
();
// Create new tasks that both start executing, rather than invoking the delegates directly
...
...
@@ -170,7 +175,7 @@ public override async ValueTask<Optional<TResult>> TryInvokeAsync<TResult>(Solut
throw
;
}
},
cancellation
Token
);
},
mustNotCancel
Token
);
var
readerTask
=
Task
.
Run
(
async
()
=>
...
...
@@ -189,7 +194,7 @@ public override async ValueTask<Optional<TResult>> TryInvokeAsync<TResult>(Solut
{
await
pipe
.
Reader
.
CompleteAsync
(
exception
).
ConfigureAwait
(
false
);
}
},
cancellation
Token
);
},
mustNotCancel
Token
);
await
Task
.
WhenAll
(
writerTask
,
readerTask
).
ConfigureAwait
(
false
);
...
...
src/Workspaces/Remote/Core/RemoteHostAssetSerialization.cs
浏览文件 @
57759e39
...
...
@@ -88,6 +88,11 @@ static void WriteAsset(ObjectWriter writer, ISerializerService serializer, Check
public
static
async
ValueTask
<
ImmutableArray
<(
Checksum
,
object
)>>
ReadDataAsync
(
PipeReader
pipeReader
,
int
scopeId
,
ISet
<
Checksum
>
checksums
,
ISerializerService
serializerService
,
CancellationToken
cancellationToken
)
{
// We can cancel at entry, but once the pipe operations are scheduled we rely on both operations running to
// avoid deadlocks (the exception handler in 'copyTask' ensures progress is made in the blocking read).
cancellationToken
.
ThrowIfCancellationRequested
();
var
mustNotCancelToken
=
CancellationToken
.
None
;
// Workaround for ObjectReader not supporting async reading.
// Unless we read from the RPC stream asynchronously and with cancallation support we might hang when the server cancels.
// https://github.com/dotnet/roslyn/issues/47861
...
...
@@ -113,7 +118,7 @@ public static async ValueTask<ImmutableArray<(Checksum, object)>> ReadDataAsync(
await
localPipe
.
Writer
.
CompleteAsync
(
exception
).
ConfigureAwait
(
false
);
await
pipeReader
.
CompleteAsync
(
exception
).
ConfigureAwait
(
false
);
}
},
cancellation
Token
);
},
mustNotCancel
Token
);
// blocking read from the local pipe on the current thread:
try
...
...
src/Workspaces/Remote/Core/SolutionAssetProvider.cs
浏览文件 @
57759e39
...
...
@@ -52,6 +52,11 @@ public async ValueTask GetAssetsAsync(PipeWriter pipeWriter, int scopeId, Checks
assetMap
=
await
assetStorage
.
GetAssetsAsync
(
scopeId
,
checksums
,
cancellationToken
).
ConfigureAwait
(
false
);
}
// We can cancel early, but once the pipe operations are scheduled we rely on both operations running to
// avoid deadlocks (the exception handler in 'task1' ensures progress is made in 'task2').
cancellationToken
.
ThrowIfCancellationRequested
();
var
mustNotCancelToken
=
CancellationToken
.
None
;
// Work around the lack of async stream writing in ObjectWriter, which is required when writing to the RPC pipe.
// Run two tasks - the first synchronously writes to a local pipe and the second asynchronosly transfers the data to the RPC pipe.
//
...
...
@@ -71,7 +76,7 @@ public async ValueTask GetAssetsAsync(PipeWriter pipeWriter, int scopeId, Checks
{
// no-op
}
},
cancellation
Token
);
},
mustNotCancel
Token
);
// Complete RPC once we send the initial piece of data and start waiting for the writer to send more,
// so the client can start reading from the stream. Once CopyPipeDataAsync completes the pipeWriter
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录