Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
cd9dbdc5
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,发现更多精彩内容 >>
未验证
提交
cd9dbdc5
编写于
5月 01, 2020
作者:
T
Tomáš Matoušek
提交者:
GitHub
5月 01, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix ProjectInfo construction in AssetProvider (#43888)
上级
09180ee4
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
38 addition
and
26 deletion
+38
-26
src/VisualStudio/Core/Test.Next/Services/SolutionServiceTests.cs
...ualStudio/Core/Test.Next/Services/SolutionServiceTests.cs
+37
-26
src/Workspaces/Core/Portable/Execution/AbstractAssetProvider.cs
...rkspaces/Core/Portable/Execution/AbstractAssetProvider.cs
+1
-0
未找到文件。
src/VisualStudio/Core/Test.Next/Services/SolutionServiceTests.cs
浏览文件 @
cd9dbdc5
...
...
@@ -161,32 +161,41 @@ public async Task ProjectProperties()
{
using
var
workspace
=
TestWorkspace
.
CreateCSharp
(
""
);
await
VerifySolutionUpdate
(
workspace
,
solution
=>
static
Solution
SetProjectProperties
(
Solution
solution
,
int
version
)
{
var
projectId
=
solution
.
ProjectIds
.
Single
();
return
solution
.
WithProjectName
(
projectId
,
"NewName"
)
.
WithProjectAssemblyName
(
projectId
,
"NewAssemblyName"
)
.
WithProjectFilePath
(
projectId
,
"NewFilePath"
)
.
WithProjectOutputFilePath
(
projectId
,
"NewOutputFilePath"
)
.
WithProjectOutputRefFilePath
(
projectId
,
"NewOutputRefFilePath"
)
.
WithProjectCompilationOutputFilePaths
(
projectId
,
new
CompilationOutputFilePaths
(
"NewAssemblyPath"
))
.
WithProjectDefaultNamespace
(
projectId
,
"NewDefaultNamespace"
)
.
WithHasAllInformation
(
projectId
,
false
)
.
WithRunAnalyzers
(
projectId
,
false
);
},
solution
=>
.
WithProjectName
(
projectId
,
"Name"
+
version
)
.
WithProjectAssemblyName
(
projectId
,
"AssemblyName"
+
version
)
.
WithProjectFilePath
(
projectId
,
"FilePath"
+
version
)
.
WithProjectOutputFilePath
(
projectId
,
"OutputFilePath"
+
version
)
.
WithProjectOutputRefFilePath
(
projectId
,
"OutputRefFilePath"
+
version
)
.
WithProjectCompilationOutputFilePaths
(
projectId
,
new
CompilationOutputFilePaths
(
"AssemblyPath"
+
version
))
.
WithProjectDefaultNamespace
(
projectId
,
"DefaultNamespace"
+
version
)
.
WithHasAllInformation
(
projectId
,
(
version
%
2
)
!=
0
)
.
WithRunAnalyzers
(
projectId
,
(
version
%
2
)
!=
0
);
}
static
void
ValidateProperties
(
Solution
solution
,
int
version
)
{
var
project
=
solution
.
Projects
.
Single
();
Assert
.
Equal
(
"NewName"
,
project
.
Name
);
Assert
.
Equal
(
"NewAssemblyName"
,
project
.
AssemblyName
);
Assert
.
Equal
(
"NewFilePath"
,
project
.
FilePath
);
Assert
.
Equal
(
"NewOutputFilePath"
,
project
.
OutputFilePath
);
Assert
.
Equal
(
"NewOutputRefFilePath"
,
project
.
OutputRefFilePath
);
Assert
.
Equal
(
"NewAssemblyPath"
,
project
.
CompilationOutputFilePaths
.
AssemblyPath
);
Assert
.
Equal
(
"NewDefaultNamespace"
,
project
.
DefaultNamespace
);
Assert
.
False
(
project
.
State
.
HasAllInformation
);
Assert
.
False
(
project
.
State
.
RunAnalyzers
);
}).
ConfigureAwait
(
false
);
Assert
.
Equal
(
"Name"
+
version
,
project
.
Name
);
Assert
.
Equal
(
"AssemblyName"
+
version
,
project
.
AssemblyName
);
Assert
.
Equal
(
"FilePath"
+
version
,
project
.
FilePath
);
Assert
.
Equal
(
"OutputFilePath"
+
version
,
project
.
OutputFilePath
);
Assert
.
Equal
(
"OutputRefFilePath"
+
version
,
project
.
OutputRefFilePath
);
Assert
.
Equal
(
"AssemblyPath"
+
version
,
project
.
CompilationOutputFilePaths
.
AssemblyPath
);
Assert
.
Equal
(
"DefaultNamespace"
+
version
,
project
.
DefaultNamespace
);
Assert
.
Equal
((
version
%
2
)
!=
0
,
project
.
State
.
HasAllInformation
);
Assert
.
Equal
((
version
%
2
)
!=
0
,
project
.
State
.
RunAnalyzers
);
}
Assert
.
True
(
workspace
.
SetCurrentSolution
(
s
=>
SetProjectProperties
(
s
,
version
:
0
),
WorkspaceChangeKind
.
SolutionChanged
));
await
VerifySolutionUpdate
(
workspace
,
newSolutionGetter
:
s
=>
SetProjectProperties
(
s
,
version
:
1
),
oldSolutionValidator
:
s
=>
ValidateProperties
(
s
,
version
:
0
),
newSolutionValidator
:
s
=>
ValidateProperties
(
s
,
version
:
1
)).
ConfigureAwait
(
false
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
RemoteHost
)]
...
...
@@ -433,18 +442,20 @@ private static async Task VerifySolutionUpdate(string code, Func<Solution, Solut
private
static
async
Task
VerifySolutionUpdate
(
TestWorkspace
workspace
,
Func
<
Solution
,
Solution
>
newSolutionGetter
,
Action
<
Solution
>
solutionValidator
=
null
)
Action
<
Solution
>
oldSolutionValidator
=
null
,
Action
<
Solution
>
newSolutionValidator
=
null
)
{
var
map
=
new
Dictionary
<
Checksum
,
object
>();
var
solution
=
workspace
.
CurrentSolution
;
var
service
=
await
GetSolutionServiceAsync
(
solution
,
map
);
oldSolutionValidator
?.
Invoke
(
solution
);
var
map
=
new
Dictionary
<
Checksum
,
object
>();
var
service
=
await
GetSolutionServiceAsync
(
solution
,
map
);
var
solutionChecksum
=
await
solution
.
State
.
GetChecksumAsync
(
CancellationToken
.
None
);
// update primary workspace
await
service
.
UpdatePrimaryWorkspaceAsync
(
solutionChecksum
,
solution
.
WorkspaceVersion
,
CancellationToken
.
None
);
var
recoveredSolution
=
await
service
.
GetSolutionAsync
(
solutionChecksum
,
CancellationToken
.
None
);
oldSolutionValidator
?.
Invoke
(
recoveredSolution
);
Assert
.
IsAssignableFrom
<
RemoteWorkspace
>(
recoveredSolution
.
Workspace
);
var
primaryWorkspace
=
recoveredSolution
.
Workspace
;
...
...
@@ -469,7 +480,7 @@ private static async Task VerifySolutionUpdate(string code, Func<Solution, Solut
Assert
.
Equal
(
newSolutionChecksum
,
await
third
.
State
.
GetChecksumAsync
(
CancellationToken
.
None
));
Assert
.
Same
(
primaryWorkspace
.
PrimaryBranchId
,
third
.
BranchId
);
s
olutionValidator
?.
Invoke
(
recoveredNewSolution
);
newS
olutionValidator
?.
Invoke
(
recoveredNewSolution
);
}
private
static
async
Task
<
SolutionService
>
GetSolutionServiceAsync
(
Solution
solution
,
Dictionary
<
Checksum
,
object
>
map
=
null
)
...
...
src/Workspaces/Core/Portable/Execution/AbstractAssetProvider.cs
浏览文件 @
cd9dbdc5
...
...
@@ -87,6 +87,7 @@ public async Task<ProjectInfo> CreateProjectInfoAsync(Checksum projectChecksum,
additionalDocumentInfos
,
projectInfo
.
IsSubmission
)
.
WithOutputRefFilePath
(
projectInfo
.
OutputRefFilePath
)
.
WithCompilationOutputFilePaths
(
projectInfo
.
CompilationOutputFilePaths
)
.
WithHasAllInformation
(
projectInfo
.
HasAllInformation
)
.
WithRunAnalyzers
(
projectInfo
.
RunAnalyzers
)
.
WithDefaultNamespace
(
projectInfo
.
DefaultNamespace
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录