Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
5b43c092
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,发现更多精彩内容 >>
提交
5b43c092
编写于
8月 03, 2020
作者:
S
Sam Harwell
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move test helpers to test accessors
上级
f244a937
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
184 addition
and
83 deletion
+184
-83
src/EditorFeatures/Core/Shared/Threading/AsynchronousSerialWorkQueue.cs
...ures/Core/Shared/Threading/AsynchronousSerialWorkQueue.cs
+27
-12
src/EditorFeatures/Test/SolutionCrawler/WorkCoordinatorTests.cs
...itorFeatures/Test/SolutionCrawler/WorkCoordinatorTests.cs
+1
-1
src/EditorFeatures/Test/Threading/AsynchronousWorkerTests.cs
src/EditorFeatures/Test/Threading/AsynchronousWorkerTests.cs
+1
-1
src/EditorFeatures/Test2/Diagnostics/AddImport/AddImportCrossLanguageTests.vb
...est2/Diagnostics/AddImport/AddImportCrossLanguageTests.vb
+1
-1
src/EditorFeatures/Test2/Diagnostics/DiagnosticProviderTests.vb
...itorFeatures/Test2/Diagnostics/DiagnosticProviderTests.vb
+1
-1
src/EditorFeatures/TestUtilities/Diagnostics/DiagnosticTaggerWrapper.cs
...ures/TestUtilities/Diagnostics/DiagnosticTaggerWrapper.cs
+1
-1
src/Features/Core/Portable/SolutionCrawler/SolutionCrawlerRegistrationService.cs
...ble/SolutionCrawler/SolutionCrawlerRegistrationService.cs
+39
-16
src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.IncrementalAnalyzerProcessor.cs
...onCrawler/WorkCoordinator.IncrementalAnalyzerProcessor.cs
+23
-8
src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.LowPriorityProcessor.cs
...e/SolutionCrawler/WorkCoordinator.LowPriorityProcessor.cs
+26
-11
src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.NormalPriorityProcessor.cs
...olutionCrawler/WorkCoordinator.NormalPriorityProcessor.cs
+24
-9
src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.cs
...Features/Core/Portable/SolutionCrawler/WorkCoordinator.cs
+25
-10
src/Tools/AnalyzerRunner/AnalyzerRunner.csproj
src/Tools/AnalyzerRunner/AnalyzerRunner.csproj
+1
-0
src/Tools/AnalyzerRunner/IncrementalAnalyzerRunner.cs
src/Tools/AnalyzerRunner/IncrementalAnalyzerRunner.cs
+1
-1
src/VisualStudio/Core/Test/Diagnostics/DiagnosticTableDataSourceTests.vb
...o/Core/Test/Diagnostics/DiagnosticTableDataSourceTests.vb
+1
-1
src/Workspaces/Core/Portable/FindSymbols/SymbolTree/SymbolTreeInfo_Serialization.cs
...le/FindSymbols/SymbolTree/SymbolTreeInfo_Serialization.cs
+11
-8
src/Workspaces/CoreTest/FindAllDeclarationsTests.cs
src/Workspaces/CoreTest/FindAllDeclarationsTests.cs
+1
-2
未找到文件。
src/EditorFeatures/Core/Shared/Threading/AsynchronousSerialWorkQueue.cs
浏览文件 @
5b43c092
...
...
@@ -159,20 +159,35 @@ public void WaitForPendingBackgroundWork()
_currentBackgroundTask
.
Wait
();
}
/// <summary>
/// Wait until all tasks have been completed. NOTE that this will do a pumping wait if
/// called on the UI thread. Also, it isn't guaranteed to be stable in the case of tasks
/// enqueuing other tasks in arbitrary orders, though it does support our common pattern of
/// "timer task->background task->foreground task with results"
///
/// Use this method very judiciously. Most of the time, we should be able to just use
/// IAsynchronousOperationListener for tests.
/// </summary>
public
void
WaitUntilCompletion_ForTestingPurposesOnly
()
internal
TestAccessor
GetTestAccessor
()
{
AssertIsForeground
();
return
new
TestAccessor
(
this
);
}
internal
readonly
struct
TestAccessor
{
private
readonly
AsynchronousSerialWorkQueue
_asynchronousSerialWorkQueue
;
WaitForPendingBackgroundWork
();
internal
TestAccessor
(
AsynchronousSerialWorkQueue
asynchronousSerialWorkQueue
)
{
_asynchronousSerialWorkQueue
=
asynchronousSerialWorkQueue
;
}
/// <summary>
/// Wait until all tasks have been completed. NOTE that this will do a pumping wait if
/// called on the UI thread. Also, it isn't guaranteed to be stable in the case of tasks
/// enqueuing other tasks in arbitrary orders, though it does support our common pattern of
/// "timer task->background task->foreground task with results"
///
/// Use this method very judiciously. Most of the time, we should be able to just use
/// IAsynchronousOperationListener for tests.
/// </summary>
public
void
WaitUntilCompletion
()
{
_asynchronousSerialWorkQueue
.
AssertIsForeground
();
_asynchronousSerialWorkQueue
.
WaitForPendingBackgroundWork
();
}
}
}
}
src/EditorFeatures/Test/SolutionCrawler/WorkCoordinatorTests.cs
浏览文件 @
5b43c092
...
...
@@ -1315,7 +1315,7 @@ private static async Task WaitAsync(SolutionCrawlerRegistrationService service,
{
await
WaitWaiterAsync
(
workspace
.
ExportProvider
);
service
.
WaitUntilCompletion_ForTestingPurposesOnly
(
workspace
);
service
.
GetTestAccessor
().
WaitUntilCompletion
(
workspace
);
}
private
static
async
Task
WaitWaiterAsync
(
ExportProvider
provider
)
...
...
src/EditorFeatures/Test/Threading/AsynchronousWorkerTests.cs
浏览文件 @
5b43c092
...
...
@@ -246,7 +246,7 @@ public void TestBackgroundCancelMultipleActions()
try
{
worker
.
WaitUntilCompletion_ForTestingPurposesOnly
();
worker
.
GetTestAccessor
().
WaitUntilCompletion
();
Assert
.
True
(
false
);
}
catch
(
AggregateException
ae
)
...
...
src/EditorFeatures/Test2/Diagnostics/AddImport/AddImportCrossLanguageTests.vb
浏览文件 @
5b43c092
...
...
@@ -404,7 +404,7 @@ End Namespace
Dim
provider
=
DirectCast
(
workspace
.
ExportProvider
.
GetExports
(
Of
IWorkspaceServiceFactory
).
First
(
Function
(
f
)
TypeOf
f
.
Value
Is
SymbolTreeInfoIncrementalAnalyzerProvider
).
Value
,
SymbolTreeInfoIncrementalAnalyzerProvider
)
Dim
analyzer
=
provider
.
CreateIncrementalAnalyzer
(
workspace
)
solutionCrawler
.
WaitUntilCompletion_ForTestingPurposesOnly
(
workspace
,
ImmutableArray
.
Create
(
analyzer
))
solutionCrawler
.
GetTestAccessor
().
WaitUntilCompletion
(
workspace
,
ImmutableArray
.
Create
(
analyzer
))
End
Sub
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsAddImport
)
>
...
...
src/EditorFeatures/Test2/Diagnostics/DiagnosticProviderTests.vb
浏览文件 @
5b43c092
...
...
@@ -323,7 +323,7 @@ Namespace Microsoft.CodeAnalysis.Editor.Implementation.Diagnostics.UnitTests
' CollectErrors generates interleaved background and foreground tasks.
Dim
service
=
DirectCast
(
workspace
.
Services
.
GetService
(
Of
ISolutionCrawlerRegistrationService
)(),
SolutionCrawlerRegistrationService
)
service
.
WaitUntilCompletion_ForTestingPurposesOnly
(
workspace
,
SpecializedCollections
.
SingletonEnumerable
(
analyzerService
.
CreateIncrementalAnalyzer
(
workspace
)).
WhereNotNull
().
ToImmutableArray
())
service
.
GetTestAccessor
().
WaitUntilCompletion
(
workspace
,
SpecializedCollections
.
SingletonEnumerable
(
analyzerService
.
CreateIncrementalAnalyzer
(
workspace
)).
WhereNotNull
().
ToImmutableArray
())
Return
analyzerService
End
Function
...
...
src/EditorFeatures/TestUtilities/Diagnostics/DiagnosticTaggerWrapper.cs
浏览文件 @
5b43c092
...
...
@@ -105,7 +105,7 @@ public async Task WaitForTags()
{
if
(
_solutionCrawlerService
!=
null
)
{
_solutionCrawlerService
.
WaitUntilCompletion_ForTestingPurposesOnly
(
_workspace
,
_incrementalAnalyzers
);
_solutionCrawlerService
.
GetTestAccessor
().
WaitUntilCompletion
(
_workspace
,
_incrementalAnalyzers
);
}
await
_listenerProvider
.
GetWaiter
(
FeatureAttribute
.
DiagnosticService
).
ExpeditedWaitAsync
();
...
...
src/Features/Core/Portable/SolutionCrawler/SolutionCrawlerRegistrationService.cs
浏览文件 @
5b43c092
...
...
@@ -165,22 +165,6 @@ public void Reanalyze(Workspace workspace, IIncrementalAnalyzer analyzer, IEnume
}
}
internal
void
WaitUntilCompletion_ForTestingPurposesOnly
(
Workspace
workspace
,
ImmutableArray
<
IIncrementalAnalyzer
>
workers
)
{
if
(
_documentWorkCoordinatorMap
.
TryGetValue
(
workspace
,
out
var
coordinator
))
{
coordinator
.
WaitUntilCompletion_ForTestingPurposesOnly
(
workers
);
}
}
internal
void
WaitUntilCompletion_ForTestingPurposesOnly
(
Workspace
workspace
)
{
if
(
_documentWorkCoordinatorMap
.
TryGetValue
(
workspace
,
out
var
coordinator
))
{
coordinator
.
WaitUntilCompletion_ForTestingPurposesOnly
();
}
}
private
IEnumerable
<
Lazy
<
IIncrementalAnalyzerProvider
,
IncrementalAnalyzerProviderMetadata
>>
GetAnalyzerProviders
(
string
workspaceKind
)
{
foreach
(
var
(
_
,
lazyProviders
)
in
_analyzerProviders
)
...
...
@@ -269,6 +253,45 @@ internal void WaitUntilCompletion_ForTestingPurposesOnly(Workspace workspace)
private
static
bool
IsDefaultProvider
(
IncrementalAnalyzerProviderMetadata
providerMetadata
)
=>
providerMetadata
.
WorkspaceKinds
==
null
||
providerMetadata
.
WorkspaceKinds
.
Count
==
0
;
internal
TestAccessor
GetTestAccessor
()
{
return
new
TestAccessor
(
this
);
}
internal
readonly
struct
TestAccessor
{
private
readonly
SolutionCrawlerRegistrationService
_solutionCrawlerRegistrationService
;
internal
TestAccessor
(
SolutionCrawlerRegistrationService
solutionCrawlerRegistrationService
)
{
_solutionCrawlerRegistrationService
=
solutionCrawlerRegistrationService
;
}
private
bool
TryGetWorkCoordinator
(
Workspace
workspace
,
[
NotNullWhen
(
true
)]
out
WorkCoordinator
?
coordinator
)
{
lock
(
_solutionCrawlerRegistrationService
.
_gate
)
{
return
_solutionCrawlerRegistrationService
.
_documentWorkCoordinatorMap
.
TryGetValue
(
workspace
,
out
coordinator
);
}
}
internal
void
WaitUntilCompletion
(
Workspace
workspace
,
ImmutableArray
<
IIncrementalAnalyzer
>
workers
)
{
if
(
TryGetWorkCoordinator
(
workspace
,
out
var
coordinator
))
{
coordinator
.
GetTestAccessor
().
WaitUntilCompletion
(
workers
);
}
}
internal
void
WaitUntilCompletion
(
Workspace
workspace
)
{
if
(
TryGetWorkCoordinator
(
workspace
,
out
var
coordinator
))
{
coordinator
.
GetTestAccessor
().
WaitUntilCompletion
();
}
}
}
private
class
Registration
{
public
readonly
int
CorrelationId
;
...
...
src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.IncrementalAnalyzerProcessor.cs
浏览文件 @
5b43c092
...
...
@@ -407,18 +407,33 @@ private static bool CrashUnlessCanceled(AggregateException aggregate)
return
false
;
}
internal
void
WaitUntilCompletion_ForTestingPurposesOnly
(
ImmutableArray
<
IIncrementalAnalyzer
>
analyzers
,
List
<
WorkItem
>
items
)
internal
TestAccessor
GetTestAccessor
(
)
{
_normalPriorityProcessor
.
WaitUntilCompletion_ForTestingPurposesOnly
(
analyzers
,
items
);
var
projectItems
=
items
.
Select
(
i
=>
i
.
ToProjectWorkItem
(
EmptyAsyncToken
.
Instance
));
_lowPriorityProcessor
.
WaitUntilCompletion_ForTestingPurposesOnly
(
analyzers
,
items
);
return
new
TestAccessor
(
this
);
}
internal
void
WaitUntilCompletion_ForTestingPurposesOnly
()
internal
readonly
struct
TestAccessor
{
_normalPriorityProcessor
.
WaitUntilCompletion_ForTestingPurposesOnly
();
_lowPriorityProcessor
.
WaitUntilCompletion_ForTestingPurposesOnly
();
private
readonly
IncrementalAnalyzerProcessor
_incrementalAnalyzerProcessor
;
internal
TestAccessor
(
IncrementalAnalyzerProcessor
incrementalAnalyzerProcessor
)
{
_incrementalAnalyzerProcessor
=
incrementalAnalyzerProcessor
;
}
internal
void
WaitUntilCompletion
(
ImmutableArray
<
IIncrementalAnalyzer
>
analyzers
,
List
<
WorkItem
>
items
)
{
_incrementalAnalyzerProcessor
.
_normalPriorityProcessor
.
GetTestAccessor
().
WaitUntilCompletion
(
analyzers
,
items
);
var
projectItems
=
items
.
Select
(
i
=>
i
.
ToProjectWorkItem
(
EmptyAsyncToken
.
Instance
));
_incrementalAnalyzerProcessor
.
_lowPriorityProcessor
.
GetTestAccessor
().
WaitUntilCompletion
(
analyzers
,
items
);
}
internal
void
WaitUntilCompletion
()
{
_incrementalAnalyzerProcessor
.
_normalPriorityProcessor
.
GetTestAccessor
().
WaitUntilCompletion
();
_incrementalAnalyzerProcessor
.
_lowPriorityProcessor
.
GetTestAccessor
().
WaitUntilCompletion
();
}
}
private
class
NullDisposable
:
IDisposable
...
...
src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.LowPriorityProcessor.cs
浏览文件 @
5b43c092
...
...
@@ -195,24 +195,39 @@ public override void Shutdown()
_workItemQueue
.
Dispose
();
}
internal
void
WaitUntilCompletion_ForTestingPurposesOnly
(
ImmutableArray
<
IIncrementalAnalyzer
>
analyzers
,
List
<
WorkItem
>
items
)
internal
TestAccessor
GetTestAccessor
(
)
{
var
uniqueIds
=
new
HashSet
<
ProjectId
>();
foreach
(
var
item
in
items
)
return
new
TestAccessor
(
this
);
}
internal
readonly
struct
TestAccessor
{
private
readonly
LowPriorityProcessor
_lowPriorityProcessor
;
internal
TestAccessor
(
LowPriorityProcessor
lowPriorityProcessor
)
{
_lowPriorityProcessor
=
lowPriorityProcessor
;
}
internal
void
WaitUntilCompletion
(
ImmutableArray
<
IIncrementalAnalyzer
>
analyzers
,
List
<
WorkItem
>
items
)
{
if
(
uniqueIds
.
Add
(
item
.
ProjectId
))
var
uniqueIds
=
new
HashSet
<
ProjectId
>();
foreach
(
var
item
in
items
)
{
ProcessProjectAsync
(
analyzers
,
item
,
CancellationToken
.
None
).
Wait
();
if
(
uniqueIds
.
Add
(
item
.
ProjectId
))
{
_lowPriorityProcessor
.
ProcessProjectAsync
(
analyzers
,
item
,
CancellationToken
.
None
).
Wait
();
}
}
}
}
internal
void
WaitUntilCompletion_ForTestingPurposesOnly
()
{
// this shouldn't happen. would like to get some diagnostic
while
(
_workItemQueue
.
HasAnyWork
)
internal
void
WaitUntilCompletion
()
{
FailFast
.
Fail
(
"How?"
);
// this shouldn't happen. would like to get some diagnostic
while
(
_lowPriorityProcessor
.
_workItemQueue
.
HasAnyWork
)
{
FailFast
.
Fail
(
"How?"
);
}
}
}
}
...
...
src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.NormalPriorityProcessor.cs
浏览文件 @
5b43c092
...
...
@@ -587,20 +587,35 @@ public override void Shutdown()
_projectCache
=
null
;
}
internal
void
WaitUntilCompletion_ForTestingPurposesOnly
(
ImmutableArray
<
IIncrementalAnalyzer
>
analyzers
,
List
<
WorkItem
>
items
)
internal
TestAccessor
GetTestAccessor
(
)
{
foreach
(
var
item
in
items
)
{
ProcessDocumentAsync
(
analyzers
,
item
,
CancellationToken
.
None
).
Wait
();
}
return
new
TestAccessor
(
this
);
}
internal
void
WaitUntilCompletion_ForTestingPurposesOnly
()
internal
readonly
struct
TestAccessor
{
// this shouldn't happen. would like to get some diagnostic
while
(
_workItemQueue
.
HasAnyWork
)
private
readonly
NormalPriorityProcessor
_normalPriorityProcessor
;
internal
TestAccessor
(
NormalPriorityProcessor
normalPriorityProcessor
)
{
FailFast
.
Fail
(
"How?"
);
_normalPriorityProcessor
=
normalPriorityProcessor
;
}
internal
void
WaitUntilCompletion
(
ImmutableArray
<
IIncrementalAnalyzer
>
analyzers
,
List
<
WorkItem
>
items
)
{
foreach
(
var
item
in
items
)
{
_normalPriorityProcessor
.
ProcessDocumentAsync
(
analyzers
,
item
,
CancellationToken
.
None
).
Wait
();
}
}
internal
void
WaitUntilCompletion
()
{
// this shouldn't happen. would like to get some diagnostic
while
(
_normalPriorityProcessor
.
_workItemQueue
.
HasAnyWork
)
{
FailFast
.
Fail
(
"How?"
);
}
}
}
}
...
...
src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.cs
浏览文件 @
5b43c092
...
...
@@ -662,24 +662,39 @@ private async Task EnqueueWorkItemAfterDiffAsync(Solution oldSolution, Solution
await
EnqueueWorkItemAsync
(
oldProject
.
GetRequiredDocument
(
documentId
),
newProject
.
GetRequiredDocument
(
documentId
)).
ConfigureAwait
(
continueOnCapturedContext
:
false
);
}
internal
void
WaitUntilCompletion_ForTestingPurposesOnly
(
ImmutableArray
<
IIncrementalAnalyzer
>
workers
)
internal
TestAccessor
GetTestAccessor
(
)
{
var
solution
=
_registration
.
CurrentSolution
;
var
list
=
new
List
<
WorkItem
>();
return
new
TestAccessor
(
this
);
}
internal
readonly
struct
TestAccessor
{
private
readonly
WorkCoordinator
_workCoordinator
;
internal
TestAccessor
(
WorkCoordinator
workCoordinator
)
{
_workCoordinator
=
workCoordinator
;
}
foreach
(
var
project
in
solution
.
Project
s
)
internal
void
WaitUntilCompletion
(
ImmutableArray
<
IIncrementalAnalyzer
>
worker
s
)
{
foreach
(
var
document
in
project
.
Documents
)
var
solution
=
_workCoordinator
.
_registration
.
CurrentSolution
;
var
list
=
new
List
<
WorkItem
>();
foreach
(
var
project
in
solution
.
Projects
)
{
list
.
Add
(
new
WorkItem
(
document
.
Id
,
document
.
Project
.
Language
,
InvocationReasons
.
DocumentAdded
,
isLowPriority
:
false
,
activeMember
:
null
,
EmptyAsyncToken
.
Instance
));
foreach
(
var
document
in
project
.
Documents
)
{
list
.
Add
(
new
WorkItem
(
document
.
Id
,
document
.
Project
.
Language
,
InvocationReasons
.
DocumentAdded
,
isLowPriority
:
false
,
activeMember
:
null
,
EmptyAsyncToken
.
Instance
));
}
}
_workCoordinator
.
_documentAndProjectWorkerProcessor
.
GetTestAccessor
().
WaitUntilCompletion
(
workers
,
list
);
}
_documentAndProjectWorkerProcessor
.
WaitUntilCompletion_ForTestingPurposesOnly
(
workers
,
list
);
internal
void
WaitUntilCompletion
()
=>
_workCoordinator
.
_documentAndProjectWorkerProcessor
.
GetTestAccessor
().
WaitUntilCompletion
();
}
internal
void
WaitUntilCompletion_ForTestingPurposesOnly
()
=>
_documentAndProjectWorkerProcessor
.
WaitUntilCompletion_ForTestingPurposesOnly
();
}
private
readonly
struct
ReanalyzeScope
...
...
src/Tools/AnalyzerRunner/AnalyzerRunner.csproj
浏览文件 @
5b43c092
...
...
@@ -5,6 +5,7 @@
<PropertyGroup>
<OutputType>
Exe
</OutputType>
<TargetFrameworks>
netcoreapp3.1;net472
</TargetFrameworks>
<IsShipping>
false
</IsShipping>
<PlatformTarget>
AnyCPU
</PlatformTarget>
<ServerGarbageCollection>
true
</ServerGarbageCollection>
<!-- https://github.com/dotnet/runtime/issues/1713 -->
...
...
src/Tools/AnalyzerRunner/IncrementalAnalyzerRunner.cs
浏览文件 @
5b43c092
...
...
@@ -68,7 +68,7 @@ public async Task RunAsync(CancellationToken cancellationToken)
incrementalAnalyzerProvider
??=
incrementalAnalyzerProviders
.
Where
(
x
=>
x
.
Metadata
.
Name
==
incrementalAnalyzerName
).
SingleOrDefault
(
provider
=>
provider
.
Metadata
.
WorkspaceKinds
?.
Contains
(
WorkspaceKind
.
RemoteWorkspace
)
??
false
)?.
Value
;
incrementalAnalyzerProvider
??=
incrementalAnalyzerProviders
.
Where
(
x
=>
x
.
Metadata
.
Name
==
incrementalAnalyzerName
).
Single
(
provider
=>
provider
.
Metadata
.
WorkspaceKinds
is
null
).
Value
;
var
incrementalAnalyzer
=
incrementalAnalyzerProvider
.
CreateIncrementalAnalyzer
(
_workspace
);
solutionCrawlerRegistrationService
.
WaitUntilCompletion_ForTestingPurposesOnly
(
_workspace
,
ImmutableArray
.
Create
(
incrementalAnalyzer
));
solutionCrawlerRegistrationService
.
GetTestAccessor
().
WaitUntilCompletion
(
_workspace
,
ImmutableArray
.
Create
(
incrementalAnalyzer
));
switch
(
incrementalAnalyzerName
)
{
...
...
src/VisualStudio/Core/Test/Diagnostics/DiagnosticTableDataSourceTests.vb
浏览文件 @
5b43c092
...
...
@@ -783,7 +783,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics
Dim
service
=
DirectCast
(
workspace
.
Services
.
GetService
(
Of
ISolutionCrawlerRegistrationService
)(),
SolutionCrawlerRegistrationService
)
service
.
Register
(
workspace
)
service
.
WaitUntilCompletion_ForTestingPurposesOnly
(
workspace
,
SpecializedCollections
.
SingletonEnumerable
(
analyzerService
.
CreateIncrementalAnalyzer
(
workspace
)).
WhereNotNull
().
ToImmutableArray
())
service
.
GetTestAccessor
().
WaitUntilCompletion
(
workspace
,
SpecializedCollections
.
SingletonEnumerable
(
analyzerService
.
CreateIncrementalAnalyzer
(
workspace
)).
WhereNotNull
().
ToImmutableArray
())
End
Sub
Private
Function
CreateItem
(
documentId
As
DocumentId
,
Optional
severity
As
DiagnosticSeverity
=
DiagnosticSeverity
.
Error
)
As
DiagnosticData
...
...
src/Workspaces/Core/Portable/FindSymbols/SymbolTree/SymbolTreeInfo_Serialization.cs
浏览文件 @
5b43c092
...
...
@@ -181,14 +181,6 @@ public void WriteTo(ObjectWriter writer)
}
}
internal
static
SymbolTreeInfo
ReadSymbolTreeInfo_ForTestingPurposesOnly
(
ObjectReader
reader
,
Checksum
checksum
)
{
return
TryReadSymbolTreeInfo
(
reader
,
checksum
,
(
names
,
nodes
)
=>
Task
.
FromResult
(
new
SpellChecker
(
checksum
,
nodes
.
Select
(
n
=>
new
StringSlice
(
names
,
n
.
NameSpan
)))));
}
private
static
SymbolTreeInfo
TryReadSymbolTreeInfo
(
ObjectReader
reader
,
Checksum
checksum
,
...
...
@@ -262,5 +254,16 @@ public void WriteTo(ObjectWriter writer)
return
null
;
}
internal
readonly
partial
struct
TestAccessor
{
internal
static
SymbolTreeInfo
ReadSymbolTreeInfo
(
ObjectReader
reader
,
Checksum
checksum
)
{
return
TryReadSymbolTreeInfo
(
reader
,
checksum
,
(
names
,
nodes
)
=>
Task
.
FromResult
(
new
SpellChecker
(
checksum
,
nodes
.
Select
(
n
=>
new
StringSlice
(
names
,
n
.
NameSpan
)))));
}
}
}
}
src/Workspaces/CoreTest/FindAllDeclarationsTests.cs
浏览文件 @
5b43c092
...
...
@@ -685,8 +685,7 @@ public async Task TestSymbolTreeInfoSerialization()
using
var
readerStream
=
new
MemoryStream
(
writerStream
.
ToArray
());
using
var
reader
=
ObjectReader
.
TryGetReader
(
readerStream
);
var
readInfo
=
SymbolTreeInfo
.
ReadSymbolTreeInfo_ForTestingPurposesOnly
(
reader
,
Checksum
.
Null
);
var
readInfo
=
SymbolTreeInfo
.
TestAccessor
.
ReadSymbolTreeInfo
(
reader
,
Checksum
.
Null
);
info
.
AssertEquivalentTo
(
readInfo
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录