Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
bd7bc6f7
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,发现更多精彩内容 >>
提交
bd7bc6f7
编写于
6月 11, 2014
作者:
T
TomasMatousek
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add more filters to async methods, for better crash dump diagnostics. (changeset 1276034)
上级
7e5edcb7
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
255 addition
and
178 deletion
+255
-178
Src/Workspaces/Core/Workspace/Solution/Document.cs
Src/Workspaces/Core/Workspace/Solution/Document.cs
+31
-24
Src/Workspaces/Core/Workspace/Solution/Solution.CompilationTracker.cs
...es/Core/Workspace/Solution/Solution.CompilationTracker.cs
+206
-145
Src/Workspaces/Core/Workspace/Solution/Solution.cs
Src/Workspaces/Core/Workspace/Solution/Solution.cs
+15
-8
Src/Workspaces/Core/Workspaces.csproj
Src/Workspaces/Core/Workspaces.csproj
+3
-1
未找到文件。
Src/Workspaces/Core/Workspace/Solution/Document.cs
浏览文件 @
bd7bc6f7
...
...
@@ -313,40 +313,47 @@ public bool TryGetSemanticModel(out SemanticModel semanticModel)
/// </summary>
public
async
Task
<
SemanticModel
>
GetSemanticModelAsync
(
CancellationToken
cancellationToken
=
default
(
CancellationToken
))
{
if
(!
this
.
SupportsSemanticModel
)
try
{
return
null
;
}
if
(!
this
.
SupportsSemanticModel
)
{
return
null
;
}
SemanticModel
semanticModel
;
if
(
this
.
TryGetSemanticModel
(
out
semanticModel
))
{
return
semanticModel
;
}
SemanticModel
semanticModel
;
if
(
this
.
TryGetSemanticModel
(
out
semanticModel
))
{
return
semanticModel
;
}
var
syntaxTree
=
await
this
.
GetSyntaxTreeAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
var
compilation
=
await
this
.
Project
.
GetCompilationAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
var
syntaxTree
=
await
this
.
GetSyntaxTreeAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
var
compilation
=
await
this
.
Project
.
GetCompilationAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
var
result
=
compilation
.
GetSemanticModel
(
syntaxTree
);
var
result
=
compilation
.
GetSemanticModel
(
syntaxTree
);
// first try set the cache if it has not been set
var
original
=
Interlocked
.
CompareExchange
(
ref
this
.
model
,
new
WeakReference
<
SemanticModel
>(
result
),
null
);
// first try set the cache if it has not been set
var
original
=
Interlocked
.
CompareExchange
(
ref
this
.
model
,
new
WeakReference
<
SemanticModel
>(
result
),
null
);
// okay, it is first time.
if
(
original
==
null
)
{
// okay, it is first time.
if
(
original
==
null
)
{
return
result
;
}
// it looks like someone has set it. try to reuse same semantic model
if
(
original
.
TryGetTarget
(
out
semanticModel
))
{
return
semanticModel
;
}
// it looks like cache is gone. reset the cache.
original
.
SetTarget
(
result
);
return
result
;
}
// it looks like someone has set it. try to reuse same semantic model
if
(
original
.
TryGetTarget
(
out
semanticModel
))
catch
(
Exception
e
)
if
(
ExceptionHelpers
.
CrashUnlessCanceled
(
e
))
{
return
semanticModel
;
throw
ExceptionUtilities
.
Unreachable
;
}
// it looks like cache is gone. reset the cache.
original
.
SetTarget
(
result
);
return
result
;
}
/// <summary>
...
...
Src/Workspaces/Core/Workspace/Solution/Solution.CompilationTracker.cs
浏览文件 @
bd7bc6f7
此差异已折叠。
点击以展开。
Src/Workspaces/Core/Workspace/Solution/Solution.cs
浏览文件 @
bd7bc6f7
...
...
@@ -1719,17 +1719,24 @@ internal ProjectId GetProjectId(MetadataReference reference)
/// </summary>
internal
async
Task
<
MetadataReference
>
GetMetadataReferenceAsync
(
ProjectReference
projectReference
,
ProjectState
fromProject
,
CancellationToken
cancellationToken
)
{
// Get the compilation state for this project. If it's not already created, then this
// will create it. Then force that state to completion and get a metadata reference to it.
var
tracker
=
this
.
GetCompilationTracker
(
projectReference
.
ProjectId
);
var
mdref
=
await
tracker
.
GetMetadataReferenceAsync
(
this
,
fromProject
,
projectReference
,
cancellationToken
).
ConfigureAwait
(
false
);
try
{
// Get the compilation state for this project. If it's not already created, then this
// will create it. Then force that state to completion and get a metadata reference to it.
var
tracker
=
this
.
GetCompilationTracker
(
projectReference
.
ProjectId
);
var
mdref
=
await
tracker
.
GetMetadataReferenceAsync
(
this
,
fromProject
,
projectReference
,
cancellationToken
).
ConfigureAwait
(
false
);
if
(
mdref
!=
null
)
if
(
mdref
!=
null
)
{
RecordReferencedProject
(
mdref
,
projectReference
.
ProjectId
);
}
return
mdref
;
}
catch
(
Exception
e
)
if
(
ExceptionHelpers
.
CrashUnlessCanceled
(
e
))
{
RecordReferencedProject
(
mdref
,
projectReference
.
ProjectId
)
;
throw
ExceptionUtilities
.
Unreachable
;
}
return
mdref
;
}
/// <summary>
...
...
Src/Workspaces/Core/Workspaces.csproj
浏览文件 @
bd7bc6f7
...
...
@@ -868,7 +868,9 @@
<Compile
Include=
"Workspace\Solution\ProjectState.cs"
/>
<Compile
Include=
"Workspace\Solution\RecoverableTextAndVersion.cs"
/>
<Compile
Include=
"Workspace\Solution\SemanticDocument.cs"
/>
<Compile
Include=
"Workspace\Solution\Solution.CompilationTracker.cs"
/>
<Compile
Include=
"Workspace\Solution\Solution.CompilationTracker.cs"
>
<ExcludeFromStyleCop>
true
</ExcludeFromStyleCop>
</Compile>
<Compile
Include=
"Workspace\Solution\Solution.CompilationTracker.State.cs"
/>
<Compile
Include=
"Workspace\Solution\Solution.CompilationTranslationAction.Actions.cs"
/>
<Compile
Include=
"Workspace\Solution\Solution.CompilationTranslationAction.cs"
/>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录