Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
ad16d1ce
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,发现更多精彩内容 >>
提交
ad16d1ce
编写于
4月 29, 2020
作者:
J
Jason Malinowski
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add some locks assertions to confirm _NoLock methods were called correctly
上级
af1ede04
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
14 addition
and
4 deletion
+14
-4
src/VisualStudio/Core/Def/Implementation/ProjectSystem/VisualStudioWorkspaceImpl.cs
...Implementation/ProjectSystem/VisualStudioWorkspaceImpl.cs
+14
-4
未找到文件。
src/VisualStudio/Core/Def/Implementation/ProjectSystem/VisualStudioWorkspaceImpl.cs
浏览文件 @
ad16d1ce
...
...
@@ -1464,7 +1464,11 @@ public void ApplyBatchChangeToWorkspace(Func<CodeAnalysis.Solution, SolutionChan
private
readonly
Dictionary
<
ProjectId
,
ProjectReferenceInformation
>
_projectReferenceInfoMap
=
new
Dictionary
<
ProjectId
,
ProjectReferenceInformation
>();
private
ProjectReferenceInformation
GetReferenceInfo_NoLock
(
ProjectId
projectId
)
=>
_projectReferenceInfoMap
.
GetOrAdd
(
projectId
,
_
=>
new
ProjectReferenceInformation
());
{
Debug
.
Assert
(
Monitor
.
IsEntered
(
_gate
));
return
_projectReferenceInfoMap
.
GetOrAdd
(
projectId
,
_
=>
new
ProjectReferenceInformation
());
}
protected
internal
override
void
OnProjectRemoved
(
ProjectId
projectId
)
{
...
...
@@ -1575,12 +1579,14 @@ public void AddProjectOutputPath(ProjectId projectId, string outputPath)
Constraint
=
"Avoid calling "
+
nameof
(
CodeAnalysis
.
Solution
.
GetProject
)
+
" to avoid realizing all projects."
)]
private
void
ConvertMetadataReferencesToProjectReferences_NoLock
(
ProjectId
projectId
,
string
outputPath
)
{
Debug
.
Assert
(
Monitor
.
IsEntered
(
_gate
));
var
modifiedSolution
=
this
.
CurrentSolution
;
using
var
_
=
PooledHashSet
<
ProjectId
>.
GetInstance
(
out
var
projectIdsChanged
);
foreach
(
var
projectIdToRetarget
in
this
.
CurrentSolution
.
ProjectIds
)
{
if
(
CanConvertMetadataReferenceToProjectReference
(
projectIdToRetarget
,
referencedProjectId
:
projectId
))
if
(
CanConvertMetadataReferenceToProjectReference
_NoLock
(
projectIdToRetarget
,
referencedProjectId
:
projectId
))
{
// PERF: call GetProjectState instead of GetProject, otherwise creating a new project might force all
// Project instances to get created.
...
...
@@ -1611,8 +1617,10 @@ private void ConvertMetadataReferencesToProjectReferences_NoLock(ProjectId proje
[
PerformanceSensitive
(
"https://github.com/dotnet/roslyn/issues/31306"
,
Constraint
=
"Avoid calling "
+
nameof
(
CodeAnalysis
.
Solution
.
GetProject
)
+
" to avoid realizing all projects."
)]
private
bool
CanConvertMetadataReferenceToProjectReference
(
ProjectId
projectIdWithMetadataReference
,
ProjectId
referencedProjectId
)
private
bool
CanConvertMetadataReferenceToProjectReference
_NoLock
(
ProjectId
projectIdWithMetadataReference
,
ProjectId
referencedProjectId
)
{
Debug
.
Assert
(
Monitor
.
IsEntered
(
_gate
));
// PERF: call GetProjectState instead of GetProject, otherwise creating a new project might force all
// Project instances to get created.
var
projectWithMetadataReference
=
CurrentSolution
.
GetProjectState
(
projectIdWithMetadataReference
);
...
...
@@ -1649,6 +1657,8 @@ private bool CanConvertMetadataReferenceToProjectReference(ProjectId projectIdWi
Constraint
=
"Update ConvertedProjectReferences in place to avoid duplicate list allocations."
)]
private
void
ConvertProjectReferencesToMetadataReferences_NoLock
(
ProjectId
projectId
,
string
outputPath
)
{
Debug
.
Assert
(
Monitor
.
IsEntered
(
_gate
));
var
modifiedSolution
=
this
.
CurrentSolution
;
using
var
_
=
PooledHashSet
<
ProjectId
>.
GetInstance
(
out
var
projectIdsChanged
);
...
...
@@ -1697,7 +1707,7 @@ private void ConvertProjectReferencesToMetadataReferences_NoLock(ProjectId proje
{
var
projectIdToReference
=
ids
.
First
();
if
(
CanConvertMetadataReferenceToProjectReference
(
referencingProject
,
projectIdToReference
))
if
(
CanConvertMetadataReferenceToProjectReference
_NoLock
(
referencingProject
,
projectIdToReference
))
{
var
projectReference
=
new
ProjectReference
(
projectIdToReference
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录