Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
3081d207
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,发现更多精彩内容 >>
未验证
提交
3081d207
编写于
3月 21, 2019
作者:
S
Sam Harwell
提交者:
GitHub
3月 21, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #34332 from sharwell/update-vs-threading
Update Microsoft.VisualStudio.Threading
上级
a8015b9d
e60dd5e0
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
3 addition
and
84 deletion
+3
-84
eng/Versions.props
eng/Versions.props
+2
-2
eng/config/rulesets/Shipping.ruleset
eng/config/rulesets/Shipping.ruleset
+1
-0
src/EditorFeatures/Core/Shared/Utilities/MainThreadAwaitableExtensions.cs
...es/Core/Shared/Utilities/MainThreadAwaitableExtensions.cs
+0
-82
未找到文件。
eng/Versions.props
浏览文件 @
3081d207
...
...
@@ -138,8 +138,8 @@
<MicrosoftVisualStudioTextManagerInterop120Version>
12.0.30110
</MicrosoftVisualStudioTextManagerInterop120Version>
<MicrosoftVisualStudioTextManagerInterop121DesignTimeVersion>
12.1.30328
</MicrosoftVisualStudioTextManagerInterop121DesignTimeVersion>
<MicrosoftVisualStudioTextManagerInterop160DesignTimeVersion>
16.0.0
</MicrosoftVisualStudioTextManagerInterop160DesignTimeVersion>
<MicrosoftVisualStudioThreadingAnalyzersVersion>
1
5.8.19
2
</MicrosoftVisualStudioThreadingAnalyzersVersion>
<MicrosoftVisualStudioThreadingVersion>
1
5.8.19
2
</MicrosoftVisualStudioThreadingVersion>
<MicrosoftVisualStudioThreadingAnalyzersVersion>
1
6.0.10
2
</MicrosoftVisualStudioThreadingAnalyzersVersion>
<MicrosoftVisualStudioThreadingVersion>
1
6.0.10
2
</MicrosoftVisualStudioThreadingVersion>
<MicrosoftVisualStudioValidationVersion>
15.3.23
</MicrosoftVisualStudioValidationVersion>
<MicrosoftVisualStudioVsInteractiveWindowVersion>
2.0.0-rc3-61304-01
</MicrosoftVisualStudioVsInteractiveWindowVersion>
<MicrosoftWin32PrimitivesVersion>
4.3.0
</MicrosoftWin32PrimitivesVersion>
...
...
eng/config/rulesets/Shipping.ruleset
浏览文件 @
3081d207
...
...
@@ -163,6 +163,7 @@ collection.
</Rules>
<Rules
AnalyzerId=
"Microsoft.VisualStudio.Threading.Analyzers"
RuleNamespace=
"Microsoft.VisualStudio.Threading.Analyzers"
>
<Rule
Id=
"VSTHRD002"
Action=
"None"
/>
<!-- Avoid problematic synchronous waits -->
<Rule
Id=
"VSTHRD003"
Action=
"None"
/>
<!-- Avoid awaiting foreign Tasks https://github.com/dotnet/roslyn/issues/34331 -->
<Rule
Id=
"VSTHRD103"
Action=
"None"
/>
<!-- Call async methods when in an async method -->
<Rule
Id=
"VSTHRD010"
Action=
"None"
/>
<!-- Invoke single-threaded types on Main thread https://github.com/dotnet/roslyn/issues/29275 -->
<Rule
Id=
"VSTHRD110"
Action=
"None"
/>
<!-- Observe result of async calls -->
...
...
src/EditorFeatures/Core/Shared/Utilities/MainThreadAwaitableExtensions.cs
已删除
100644 → 0
浏览文件 @
a8015b9d
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using
System
;
using
System.Runtime.CompilerServices
;
using
System.Threading
;
using
Microsoft.VisualStudio.Threading
;
namespace
Microsoft.CodeAnalysis.Editor.Shared.Utilities
{
internal
static
class
JoinableTaskFactoryExtensions
{
// Provides 'alwaysYield' support prior to https://github.com/Microsoft/vs-threading/issues/326
public
static
ConfiguredMainThreadAwaitable
SwitchToMainThreadAsync
(
this
JoinableTaskFactory
joinableTaskFactory
,
bool
alwaysYield
,
CancellationToken
cancellationToken
=
default
)
{
#pragma warning disable VSTHRD004 // Await SwitchToMainThreadAsync
return
new
ConfiguredMainThreadAwaitable
(
joinableTaskFactory
.
SwitchToMainThreadAsync
(
cancellationToken
),
alwaysYield
);
#pragma warning restore VSTHRD004 // Await SwitchToMainThreadAsync
}
internal
readonly
struct
ConfiguredMainThreadAwaitable
{
private
readonly
JoinableTaskFactory
.
MainThreadAwaitable
_mainThreadAwaitable
;
private
readonly
bool
_alwaysYield
;
public
ConfiguredMainThreadAwaitable
(
JoinableTaskFactory
.
MainThreadAwaitable
mainThreadAwaitable
,
bool
alwaysYield
)
{
_mainThreadAwaitable
=
mainThreadAwaitable
;
_alwaysYield
=
alwaysYield
;
}
public
ConfiguredMainThreadAwaiter
GetAwaiter
()
{
return
new
ConfiguredMainThreadAwaiter
(
_mainThreadAwaitable
.
GetAwaiter
(),
_alwaysYield
);
}
}
internal
readonly
struct
ConfiguredMainThreadAwaiter
:
ICriticalNotifyCompletion
{
private
readonly
JoinableTaskFactory
.
MainThreadAwaiter
_mainThreadAwaiter
;
private
readonly
bool
_alwaysYield
;
public
ConfiguredMainThreadAwaiter
(
JoinableTaskFactory
.
MainThreadAwaiter
mainThreadAwaiter
,
bool
alwaysYield
)
{
_mainThreadAwaiter
=
mainThreadAwaiter
;
_alwaysYield
=
alwaysYield
;
}
public
bool
IsCompleted
{
get
{
if
(
_alwaysYield
)
{
return
false
;
}
return
_mainThreadAwaiter
.
IsCompleted
;
}
}
public
void
OnCompleted
(
Action
continuation
)
=>
_mainThreadAwaiter
.
OnCompleted
(
continuation
);
public
void
UnsafeOnCompleted
(
Action
continuation
)
{
// This should be simplified to a simple call to UnsafeOnCompleted when vs-threading is updated to a
// version where MainThreadAwaiter implements ICriticalNotifyCompletion.
if
((
object
)
_mainThreadAwaiter
is
ICriticalNotifyCompletion
criticalNotifyCompletion
)
{
criticalNotifyCompletion
.
UnsafeOnCompleted
(
continuation
);
}
else
{
_mainThreadAwaiter
.
OnCompleted
(
continuation
);
}
}
public
void
GetResult
()
=>
_mainThreadAwaiter
.
GetResult
();
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录