Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
d7962505
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,发现更多精彩内容 >>
提交
d7962505
编写于
6月 12, 2014
作者:
A
angocke
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add missing ConfigureAwait(false)'s to the compiler . (changeset 1277353)
上级
03758376
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
32 addition
and
32 deletion
+32
-32
Src/Compilers/Core/MSBuildTasks/BuildClient.cs
Src/Compilers/Core/MSBuildTasks/BuildClient.cs
+1
-1
Src/Compilers/Core/Source/DiagnosticAnalyzer/AnalyzerDriver3.cs
...mpilers/Core/Source/DiagnosticAnalyzer/AnalyzerDriver3.cs
+14
-14
Src/Compilers/Core/VBCSCompiler/ServerDispatcher.Connection.cs
...ompilers/Core/VBCSCompiler/ServerDispatcher.Connection.cs
+4
-4
Src/Workspaces/CoreTest/FindAllDeclarationsTests.cs
Src/Workspaces/CoreTest/FindAllDeclarationsTests.cs
+9
-9
Src/Workspaces/CoreTest/SyntaxTreeStorageServiceTests.cs
Src/Workspaces/CoreTest/SyntaxTreeStorageServiceTests.cs
+4
-4
未找到文件。
Src/Compilers/Core/MSBuildTasks/BuildClient.cs
浏览文件 @
d7962505
...
...
@@ -438,7 +438,7 @@ private async Task MonitorPipeForDisconnectionAsync(PipeStream pipeStream, Cance
}
CompilerServerLogger
.
Log
(
"After poking pipe."
);
// Wait a hundredth of a second before trying again
await
Task
.
Delay
(
10
);
await
Task
.
Delay
(
10
)
.
ConfigureAwait
(
false
)
;
}
if
(!
cancellationToken
.
IsCancellationRequested
)
...
...
Src/Compilers/Core/Source/DiagnosticAnalyzer/AnalyzerDriver3.cs
浏览文件 @
d7962505
...
...
@@ -51,7 +51,7 @@ public AnalyzerDriver3(IDiagnosticAnalyzer[] analyzers, Func<SyntaxNode, TSyntax
initialWorker
=
Task
.
Run
(
async
()
=>
{
try
{
await
InitialWorker
(
analyzers
,
continueOnError
,
cancellationToken
);
await
InitialWorker
(
analyzers
,
continueOnError
,
cancellationToken
)
.
ConfigureAwait
(
false
)
;
}
catch
(
OperationCanceledException
)
{
...
...
@@ -90,7 +90,7 @@ public async Task<ImmutableArray<Diagnostic>> DiagnosticsAsync()
{
var
q
=
DiagnosticQueue
;
var
allDiagnostics
=
DiagnosticBag
.
GetInstance
();
await
q
.
WhenCompleted
;
await
q
.
WhenCompleted
.
ConfigureAwait
(
false
)
;
Diagnostic
d
;
while
(
q
.
TryDequeue
(
out
d
))
{
...
...
@@ -108,10 +108,10 @@ public async Task<ImmutableArray<Diagnostic>> DiagnosticsAsync()
/// <returns></returns>
public
async
Task
WhenCompleted
()
{
await
CompilationEventQueue
.
WhenCompleted
;
await
CompilationEventQueue
.
WhenCompleted
.
ConfigureAwait
(
false
)
;
foreach
(
var
worker
in
workers
)
{
await
worker
;
await
worker
.
ConfigureAwait
(
false
)
;
}
}
...
...
@@ -124,7 +124,7 @@ public void Dispose()
private
async
Task
InitialWorker
(
IDiagnosticAnalyzer
[]
analyzers
,
bool
continueOnError
,
CancellationToken
cancellationToken
)
{
// Pull out the first event, which should be the "start compilation" event.
var
firstEvent
=
await
CompilationEventQueue
.
DequeueAsync
(
/*cancellationToken*/
);
var
firstEvent
=
await
CompilationEventQueue
.
DequeueAsync
(
/*cancellationToken*/
)
.
ConfigureAwait
(
false
)
;
var
startCompilation
=
firstEvent
as
CompilationEvent
.
CompilationStarted
;
if
(
startCompilation
==
null
)
{
...
...
@@ -135,7 +135,7 @@ private async Task InitialWorker(IDiagnosticAnalyzer[] analyzers, bool continueO
DiagnosticQueue
.
Complete
();
while
(
CompilationEventQueue
.
Count
!=
0
)
{
var
drainedEvent
=
await
CompilationEventQueue
.
DequeueAsync
();
var
drainedEvent
=
await
CompilationEventQueue
.
DequeueAsync
()
.
ConfigureAwait
(
false
)
;
}
throw
new
InvalidOperationException
(
"First event must be CompilationEvent.CompilationStarted, not "
+
startCompilation
.
GetType
().
Name
);
}
...
...
@@ -227,7 +227,7 @@ private async void ProcessCompilationEvents(CancellationToken cancellationToken)
{
try
{
await
ProcessEvents
(
cancellationToken
);
await
ProcessEvents
(
cancellationToken
)
.
ConfigureAwait
(
false
)
;
}
catch
(
TaskCanceledException
)
{
...
...
@@ -242,8 +242,8 @@ private async Task ProcessEvents(CancellationToken cancellationToken)
{
try
{
var
e
=
await
CompilationEventQueue
.
DequeueAsync
(
/*cancellationToken*/
);
await
ProcessEvent
(
e
,
cancellationToken
);
var
e
=
await
CompilationEventQueue
.
DequeueAsync
(
/*cancellationToken*/
)
.
ConfigureAwait
(
false
)
;
await
ProcessEvent
(
e
,
cancellationToken
)
.
ConfigureAwait
(
false
)
;
}
catch
(
TaskCanceledException
)
{
...
...
@@ -264,21 +264,21 @@ private async Task ProcessEvent(CompilationEvent e, CancellationToken cancellati
var
symbolEvent
=
e
as
CompilationEvent
.
SymbolDeclared
;
if
(
symbolEvent
!=
null
)
{
await
ProcessSymbolDeclared
(
symbolEvent
,
cancellationToken
);
await
ProcessSymbolDeclared
(
symbolEvent
,
cancellationToken
)
.
ConfigureAwait
(
false
)
;
return
;
}
var
completedEvent
=
e
as
CompilationEvent
.
CompilationUnitCompleted
;
if
(
completedEvent
!=
null
)
{
await
ProcessCompilationUnitCompleted
(
completedEvent
,
cancellationToken
);
await
ProcessCompilationUnitCompleted
(
completedEvent
,
cancellationToken
)
.
ConfigureAwait
(
false
)
;
return
;
}
var
endEvent
=
e
as
CompilationEvent
.
CompilationCompleted
;
if
(
endEvent
!=
null
)
{
await
ProcessCompilationCompleted
(
endEvent
,
cancellationToken
);
await
ProcessCompilationCompleted
(
endEvent
,
cancellationToken
)
.
ConfigureAwait
(
false
)
;
return
;
}
...
...
@@ -339,7 +339,7 @@ private Task AnalyzeSymbol(CompilationEvent.SymbolDeclared symbolEvent, Cancella
private
async
Task
AnalyzeDeclaringReference
(
CompilationEvent
.
SymbolDeclared
symbolEvent
,
SyntaxReference
decl
,
Action
<
Diagnostic
>
addDiagnostic
,
CancellationToken
cancellationToken
)
{
var
symbol
=
symbolEvent
.
Symbol
;
var
syntax
=
await
decl
.
GetSyntaxAsync
();
var
syntax
=
await
decl
.
GetSyntaxAsync
()
.
ConfigureAwait
(
false
)
;
var
endedAnalyzers
=
ArrayBuilder
<
ICodeBlockEndedAnalyzer
>.
GetInstance
();
endedAnalyzers
.
AddRange
(
CodeBlockEndedAnalyzers
);
var
nodeAnalyzers
=
ArrayBuilder
<
ISyntaxNodeAnalyzer
<
TSyntaxKind
>>.
GetInstance
();
...
...
@@ -471,7 +471,7 @@ private async Task ProcessCompilationCompleted(CompilationEvent.CompilationCompl
foreach
(
var
task
in
tasks
)
{
await
task
;
await
task
.
ConfigureAwait
(
false
)
;
}
DiagnosticQueue
.
Complete
();
...
...
Src/Compilers/Core/VBCSCompiler/ServerDispatcher.Connection.cs
浏览文件 @
d7962505
...
...
@@ -65,7 +65,7 @@ public async Task ServeConnection()
try
{
Log
(
"Begin reading request"
);
request
=
await
BuildRequest
.
ReadAsync
(
pipeStream
,
cancellationTokenSource
.
Token
);
request
=
await
BuildRequest
.
ReadAsync
(
pipeStream
,
cancellationTokenSource
.
Token
)
.
ConfigureAwait
(
false
)
;
Log
(
"End reading request"
);
}
catch
(
IOException
e
)
...
...
@@ -103,14 +103,14 @@ public async Task ServeConnection()
{
throw
ExceptionUtilities
.
Unreachable
;
}
});
})
.
ConfigureAwait
(
false
)
;
Log
(
"End compilation"
);
try
{
Log
(
"Begin writing response"
);
await
response
.
WriteAsync
(
pipeStream
,
cancellationTokenSource
.
Token
);
await
response
.
WriteAsync
(
pipeStream
,
cancellationTokenSource
.
Token
)
.
ConfigureAwait
(
false
)
;
Log
(
"End writing response"
);
}
catch
(
IOException
e
)
...
...
@@ -152,7 +152,7 @@ private async Task MonitorPipeForDisconnection()
}
Log
(
"After poking pipe."
);
// Wait a tenth of a second before trying again
await
Task
.
Delay
(
100
);
await
Task
.
Delay
(
100
)
.
ConfigureAwait
(
false
)
;
}
Log
(
"Pipe disconnected; cancelling."
);
...
...
Src/Workspaces/CoreTest/FindAllDeclarationsTests.cs
浏览文件 @
d7962505
...
...
@@ -85,7 +85,7 @@ public partial class FindAllDeclarationsTests : TestBase
public
static
async
Task
FindDeclarationsAsync_Test
(
string
searchTerm
,
bool
ignoreCase
,
WorkspaceKind
workspaceKind
,
string
[]
expectedResults
)
{
var
project
=
GetProject
(
workspaceKind
);
var
declarations
=
await
SymbolFinder
.
FindDeclarationsAsync
(
project
,
searchTerm
,
ignoreCase
);
var
declarations
=
await
SymbolFinder
.
FindDeclarationsAsync
(
project
,
searchTerm
,
ignoreCase
)
.
ConfigureAwait
(
false
)
;
Verify
(
searchTerm
,
ignoreCase
,
workspaceKind
,
declarations
,
expectedResults
);
}
...
...
@@ -200,7 +200,7 @@ public static void FindDeclarationsAsync_Test_Cancellation()
public
static
async
Task
FindSourceDeclarationsAsync_Project_Test
(
string
searchTerm
,
bool
ignoreCase
,
WorkspaceKind
workspaceKind
,
string
[]
expectedResults
)
{
var
project
=
GetProject
(
workspaceKind
);
var
declarations
=
await
SymbolFinder
.
FindSourceDeclarationsAsync
(
project
,
searchTerm
,
ignoreCase
);
var
declarations
=
await
SymbolFinder
.
FindSourceDeclarationsAsync
(
project
,
searchTerm
,
ignoreCase
)
.
ConfigureAwait
(
false
)
;
Verify
(
searchTerm
,
ignoreCase
,
workspaceKind
,
declarations
,
expectedResults
);
}
...
...
@@ -315,7 +315,7 @@ public static void FindSourceDeclarationsAsync_Project_Test_Cancellation()
public
static
async
Task
FindSourceDeclarationsAsync_Solution_Test
(
string
searchTerm
,
bool
ignoreCase
,
WorkspaceKind
workspaceKind
,
string
[]
expectedResults
)
{
var
solution
=
GetSolution
(
workspaceKind
);
var
declarations
=
await
SymbolFinder
.
FindSourceDeclarationsAsync
(
solution
,
searchTerm
,
ignoreCase
);
var
declarations
=
await
SymbolFinder
.
FindSourceDeclarationsAsync
(
solution
,
searchTerm
,
ignoreCase
)
.
ConfigureAwait
(
false
)
;
Verify
(
searchTerm
,
ignoreCase
,
workspaceKind
,
declarations
,
expectedResults
);
}
...
...
@@ -375,7 +375,7 @@ public static void FindSourceDeclarationsAsync_Solution_Test_Cancellation()
public
static
async
Task
FindSourceDeclarationsAsync_Project_Func_Test
(
WorkspaceKind
workspaceKind
,
string
[]
expectedResults
)
{
var
project
=
GetProject
(
workspaceKind
);
var
declarations
=
await
SymbolFinder
.
FindSourceDeclarationsAsync
(
project
,
str
=>
str
.
Contains
(
"Test"
));
var
declarations
=
await
SymbolFinder
.
FindSourceDeclarationsAsync
(
project
,
str
=>
str
.
Contains
(
"Test"
))
.
ConfigureAwait
(
false
)
;
Verify
(
workspaceKind
,
declarations
,
expectedResults
);
}
...
...
@@ -383,7 +383,7 @@ public static async Task FindSourceDeclarationsAsync_Project_Func_Test(Workspace
public
static
async
Task
FindSourceDeclarationsAsync_Project_Func_Test_AlwaysTruePredicate
()
{
var
project
=
GetProject
(
WorkspaceKind
.
SingleClass
);
var
declarations
=
await
SymbolFinder
.
FindSourceDeclarationsAsync
(
project
,
str
=>
true
);
var
declarations
=
await
SymbolFinder
.
FindSourceDeclarationsAsync
(
project
,
str
=>
true
)
.
ConfigureAwait
(
false
)
;
Verify
(
WorkspaceKind
.
SingleClass
,
declarations
,
"TestCases"
,
"TestCases.TestCase"
);
}
...
...
@@ -391,7 +391,7 @@ public static async Task FindSourceDeclarationsAsync_Project_Func_Test_AlwaysTru
public
static
async
Task
FindSourceDeclarationsAsync_Project_Func_Test_AlwaysFalsePredicate
()
{
var
project
=
GetProject
(
WorkspaceKind
.
SingleClass
);
var
declarations
=
await
SymbolFinder
.
FindSourceDeclarationsAsync
(
project
,
str
=>
false
);
var
declarations
=
await
SymbolFinder
.
FindSourceDeclarationsAsync
(
project
,
str
=>
false
)
.
ConfigureAwait
(
false
)
;
Verify
(
WorkspaceKind
.
SingleClass
,
declarations
);
}
...
...
@@ -467,7 +467,7 @@ public static void FindSourceDeclarationsAsync_Project_Func_Test_Cancellation()
public
static
async
Task
FindSourceDeclarationsAsync_Solution_Func_Test
(
WorkspaceKind
workspaceKind
,
string
[]
expectedResult
)
{
var
solution
=
GetSolution
(
workspaceKind
);
var
declarations
=
await
SymbolFinder
.
FindSourceDeclarationsAsync
(
solution
,
str
=>
str
.
Contains
(
"Test"
));
var
declarations
=
await
SymbolFinder
.
FindSourceDeclarationsAsync
(
solution
,
str
=>
str
.
Contains
(
"Test"
))
.
ConfigureAwait
(
false
)
;
Verify
(
workspaceKind
,
declarations
,
expectedResult
);
}
...
...
@@ -475,7 +475,7 @@ public static async Task FindSourceDeclarationsAsync_Solution_Func_Test(Workspac
public
static
async
Task
FindSourceDeclarationsAsync_Solution_Func_Test_AlwaysTruePredicate
()
{
var
solution
=
GetSolution
(
WorkspaceKind
.
SingleClass
);
var
declarations
=
await
SymbolFinder
.
FindSourceDeclarationsAsync
(
solution
,
str
=>
true
);
var
declarations
=
await
SymbolFinder
.
FindSourceDeclarationsAsync
(
solution
,
str
=>
true
)
.
ConfigureAwait
(
false
)
;
Verify
(
WorkspaceKind
.
SingleClass
,
declarations
,
"TestCases"
,
"TestCases.TestCase"
);
}
...
...
@@ -483,7 +483,7 @@ public static async Task FindSourceDeclarationsAsync_Solution_Func_Test_AlwaysTr
public
static
async
Task
FindSourceDeclarationsAsync_Solution_Func_Test_AlwaysFalsePredicate
()
{
var
solution
=
GetSolution
(
WorkspaceKind
.
SingleClass
);
var
declarations
=
await
SymbolFinder
.
FindSourceDeclarationsAsync
(
solution
,
str
=>
false
);
var
declarations
=
await
SymbolFinder
.
FindSourceDeclarationsAsync
(
solution
,
str
=>
false
)
.
ConfigureAwait
(
false
)
;
Verify
(
WorkspaceKind
.
SingleClass
,
declarations
);
}
...
...
Src/Workspaces/CoreTest/SyntaxTreeStorageServiceTests.cs
浏览文件 @
d7962505
...
...
@@ -38,7 +38,7 @@ public async Task TestEnqueueStoreAsync()
var
tree
=
CSharp
.
SyntaxFactory
.
SyntaxTree
(
root
);
// EnqueueStore and EnqueueStoreAsync is basically same thing. only difference is EnqueueStoreAsync returns Task that can be waited.
await
syntaxTreeStorageService
.
EnqueueStoreAsync
(
tree
,
root
,
tempStorageService
,
CancellationToken
.
None
);
await
syntaxTreeStorageService
.
EnqueueStoreAsync
(
tree
,
root
,
tempStorageService
,
CancellationToken
.
None
)
.
ConfigureAwait
(
false
)
;
Assert
.
True
(
syntaxTreeStorageService
.
CanRetrieve
(
tree
));
}
...
...
@@ -67,7 +67,7 @@ public async Task TestStoreAsync()
var
root
=
CSharp
.
SyntaxFactory
.
CompilationUnit
();
var
tree
=
CSharp
.
SyntaxFactory
.
SyntaxTree
(
root
);
await
syntaxTreeStorageService
.
StoreAsync
(
tree
,
root
,
tempStorageService
,
CancellationToken
.
None
);
await
syntaxTreeStorageService
.
StoreAsync
(
tree
,
root
,
tempStorageService
,
CancellationToken
.
None
)
.
ConfigureAwait
(
false
)
;
Assert
.
True
(
syntaxTreeStorageService
.
CanRetrieve
(
tree
));
}
...
...
@@ -108,7 +108,7 @@ public async Task TestRetrieveAsync()
Assert
.
True
(
syntaxTreeStorageService
.
CanRetrieve
(
tree
));
var
syntaxFactoryService
=
new
CSharp
.
CSharpSyntaxTreeFactoryServiceFactory
().
CreateLanguageService
(
provider
:
null
)
as
ISyntaxTreeFactoryService
;
var
newRoot
=
await
syntaxTreeStorageService
.
RetrieveAsync
(
tree
,
syntaxFactoryService
,
CancellationToken
.
None
);
var
newRoot
=
await
syntaxTreeStorageService
.
RetrieveAsync
(
tree
,
syntaxFactoryService
,
CancellationToken
.
None
)
.
ConfigureAwait
(
false
)
;
Assert
.
True
(
root
.
IsEquivalentTo
(
newRoot
));
...
...
@@ -140,7 +140,7 @@ public async Task TestRemoveAsync()
{
GC
.
Collect
();
await
Task
.
Delay
(
5
);
await
Task
.
Delay
(
5
)
.
ConfigureAwait
(
false
)
;
count
++;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录