Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
94e8b406
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,发现更多精彩内容 >>
未验证
提交
94e8b406
编写于
4月 01, 2020
作者:
J
Jared Parsons
提交者:
GitHub
4月 01, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #42966 from jaredpar/flaky
Fix EditorFeatures2 flakiness
上级
5e12b9ca
e603038d
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
54 addition
and
3 deletion
+54
-3
src/EditorFeatures/TestUtilities/TestExtensionErrorHandler.cs
...EditorFeatures/TestUtilities/TestExtensionErrorHandler.cs
+25
-3
src/Workspaces/CoreTestUtilities/ITestErrorHandler.cs
src/Workspaces/CoreTestUtilities/ITestErrorHandler.cs
+20
-0
src/Workspaces/CoreTestUtilities/MEF/UseExportProviderAttribute.cs
...paces/CoreTestUtilities/MEF/UseExportProviderAttribute.cs
+9
-0
未找到文件。
src/EditorFeatures/TestUtilities/TestExtensionErrorHandler.cs
浏览文件 @
94e8b406
...
...
@@ -14,10 +14,13 @@
namespace
Microsoft.CodeAnalysis.Editor.UnitTests
{
[
Export
(
typeof
(
IExtensionErrorHandler
))]
internal
class
TestExtensionErrorHandler
:
IExtensionErrorHandler
[
Export
(
typeof
(
ITestErrorHandler
))]
internal
class
TestExtensionErrorHandler
:
IExtensionErrorHandler
,
ITestErrorHandler
{
private
ImmutableList
<
Exception
>
_exceptions
=
ImmutableList
<
Exception
>.
Empty
;
public
ImmutableList
<
Exception
>
Exceptions
=>
_exceptions
;
[
ImportingConstructor
]
[
Obsolete
(
MefConstruction
.
ImportingConstructorMessage
,
error
:
true
)]
public
TestExtensionErrorHandler
()
...
...
@@ -27,12 +30,31 @@ public TestExtensionErrorHandler()
public
void
HandleError
(
object
sender
,
Exception
exception
)
{
// Work around bug that is fixed in https://devdiv.visualstudio.com/DevDiv/_git/VS-Platform/pullrequest/209513
if
(
exception
is
NullReferenceException
&&
exception
.
StackTrace
.
Contains
(
"SpanTrackingWpfToolTipPresenter"
))
if
(
exception
is
NullReferenceException
&&
exception
.
StackTrace
.
Contains
(
"SpanTrackingWpfToolTipPresenter"
))
{
return
;
}
// Work around for https://github.com/dotnet/roslyn/issues/42982
if
(
exception
is
NullReferenceException
&&
exception
.
StackTrace
.
Contains
(
"Microsoft.CodeAnalysis.Completion.Providers.AbstractEmbeddedLanguageCompletionProvider.GetLanguageProviders"
))
{
return
;
}
// Work around for https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1091056
if
(
exception
is
InvalidOperationException
&&
exception
.
StackTrace
.
Contains
(
"Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.Implementation.CompletionTelemetryHost"
))
{
return
;
}
ExceptionUtilities
.
FailFast
(
exception
);
// This exception is unexpected and as such we want the containing test case to
// fail. Unfortuntately throwing an exception here is not going to help because
// the editor is going to catch and swallow it. Store it here and wait for the
// containing workspace to notice it and throw.
_exceptions
=
_exceptions
.
Add
(
exception
);
}
}
}
src/Workspaces/CoreTestUtilities/ITestErrorHandler.cs
0 → 100644
浏览文件 @
94e8b406
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#
nullable
enable
using
System
;
using
System.Collections.Immutable
;
namespace
Microsoft.CodeAnalysis.Test.Utilities
{
public
interface
ITestErrorHandler
{
/// <summary>
/// Records unexpected exceptions thrown during test executino that can't be immediately
/// reported.
/// </summary>
ImmutableList
<
Exception
>
Exceptions
{
get
;
}
}
}
src/Workspaces/CoreTestUtilities/MEF/UseExportProviderAttribute.cs
浏览文件 @
94e8b406
...
...
@@ -133,6 +133,15 @@ public override void After(MethodInfo methodUnderTest)
{
synchronizationContext
.
ThrowIfSwitchOccurred
();
}
foreach
(
var
testErrorHandler
in
exportProvider
.
GetExportedValues
<
ITestErrorHandler
>())
{
var
exceptions
=
testErrorHandler
.
Exceptions
;
if
(
exceptions
.
Count
>
0
)
{
throw
new
AggregateException
(
"Tests threw unexpected exceptions"
,
exceptions
);
}
}
}
}
finally
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录