Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
6f3b54f3
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,发现更多精彩内容 >>
提交
6f3b54f3
编写于
6月 20, 2017
作者:
H
Heejae Chang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
renamed SolutionSynchronizationService -> RemotableDataService
上级
715e9d57
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
54 addition
and
54 deletion
+54
-54
src/Features/Core/Portable/Diagnostics/EngineV2/DiagnosticAnalyzerExecutor.cs
...rtable/Diagnostics/EngineV2/DiagnosticAnalyzerExecutor.cs
+1
-1
src/VisualStudio/Core/Def/Implementation/Remote/RemoteHostClientServiceFactory.RemoteHostClientService.cs
...RemoteHostClientServiceFactory.RemoteHostClientService.cs
+2
-2
src/VisualStudio/Core/Next/Remote/RemotableDataJsonRpcEx.cs
src/VisualStudio/Core/Next/Remote/RemotableDataJsonRpcEx.cs
+2
-2
src/VisualStudio/Core/Test.Next/Remote/RemoteHostClientServiceFactoryTests.cs
...e/Test.Next/Remote/RemoteHostClientServiceFactoryTests.cs
+1
-1
src/VisualStudio/Core/Test.Next/Services/VisualStudioDiagnosticAnalyzerExecutorTests.cs
...t/Services/VisualStudioDiagnosticAnalyzerExecutorTests.cs
+1
-1
src/Workspaces/Core/Portable/Execution/CustomAsset.cs
src/Workspaces/Core/Portable/Execution/CustomAsset.cs
+1
-1
src/Workspaces/Core/Portable/Execution/CustomAssetBuilder.cs
src/Workspaces/Core/Portable/Execution/CustomAssetBuilder.cs
+1
-1
src/Workspaces/Core/Portable/Execution/ISolutionSynchronizationService.cs
...ore/Portable/Execution/ISolutionSynchronizationService.cs
+1
-1
src/Workspaces/Core/Portable/Execution/RemotableData.cs
src/Workspaces/Core/Portable/Execution/RemotableData.cs
+1
-1
src/Workspaces/Core/Portable/Execution/SolutionSynchronizationService.cs
...Core/Portable/Execution/SolutionSynchronizationService.cs
+3
-3
src/Workspaces/Core/Portable/Remote/RemoteHostClientExtensions.cs
...spaces/Core/Portable/Remote/RemoteHostClientExtensions.cs
+1
-1
src/Workspaces/CoreTest/Execution/Extensions.cs
src/Workspaces/CoreTest/Execution/Extensions.cs
+6
-6
src/Workspaces/CoreTest/Execution/SnapshotSerializationTestBase.cs
...paces/CoreTest/Execution/SnapshotSerializationTestBase.cs
+16
-16
src/Workspaces/CoreTest/Execution/SnapshotSerializationTests.cs
...rkspaces/CoreTest/Execution/SnapshotSerializationTests.cs
+17
-17
未找到文件。
src/Features/Core/Portable/Diagnostics/EngineV2/DiagnosticAnalyzerExecutor.cs
浏览文件 @
6f3b54f3
...
...
@@ -120,7 +120,7 @@ public AnalyzerExecutor(AbstractHostDiagnosticUpdateSource hostDiagnosticUpdateS
RemoteHostClient
client
,
CompilationWithAnalyzers
analyzerDriver
,
Project
project
,
bool
forcedAnalysis
,
CancellationToken
cancellationToken
)
{
var
solution
=
project
.
Solution
;
var
snapshotService
=
solution
.
Workspace
.
Services
.
GetService
<
I
SolutionSynchronization
Service
>();
var
snapshotService
=
solution
.
Workspace
.
Services
.
GetService
<
I
RemotableData
Service
>();
// TODO: this should be moved out
var
analyzerMap
=
CreateAnalyzerMap
(
analyzerDriver
.
Analyzers
.
Where
(
a
=>
!
a
.
IsOpenFileOnly
(
project
.
Solution
.
Workspace
)));
...
...
src/VisualStudio/Core/Def/Implementation/Remote/RemoteHostClientServiceFactory.RemoteHostClientService.cs
浏览文件 @
6f3b54f3
...
...
@@ -186,7 +186,7 @@ private Checksum[] AddGlobalAssets(CancellationToken cancellationToken)
using
(
Logger
.
LogBlock
(
FunctionId
.
RemoteHostClientService_AddGlobalAssetsAsync
,
cancellationToken
))
{
var
snapshotService
=
_workspace
.
Services
.
GetService
<
I
SolutionSynchronization
Service
>();
var
snapshotService
=
_workspace
.
Services
.
GetService
<
I
RemotableData
Service
>();
var
assetBuilder
=
new
CustomAssetBuilder
(
_workspace
);
foreach
(
var
reference
in
_analyzerService
.
GetHostAnalyzerReferences
())
...
...
@@ -205,7 +205,7 @@ private void RemoveGlobalAssets()
{
using
(
Logger
.
LogBlock
(
FunctionId
.
RemoteHostClientService_RemoveGlobalAssets
,
CancellationToken
.
None
))
{
var
snapshotService
=
_workspace
.
Services
.
GetService
<
I
SolutionSynchronization
Service
>();
var
snapshotService
=
_workspace
.
Services
.
GetService
<
I
RemotableData
Service
>();
foreach
(
var
reference
in
_analyzerService
.
GetHostAnalyzerReferences
())
{
...
...
src/VisualStudio/Core/Next/Remote/RemotableDataJsonRpcEx.cs
浏览文件 @
6f3b54f3
...
...
@@ -24,7 +24,7 @@ namespace Microsoft.VisualStudio.LanguageServices.Remote
/// </summary>
internal
class
RemotableDataJsonRpcEx
:
JsonRpcEx
{
private
readonly
I
SolutionSynchronization
Service
_remotableDataService
;
private
readonly
I
RemotableData
Service
_remotableDataService
;
private
readonly
CancellationTokenSource
_source
;
/// <summary>
...
...
@@ -39,7 +39,7 @@ public RemotableDataJsonRpcEx(Microsoft.CodeAnalysis.Workspace workspace, Stream
_gate
=
new
object
();
_count
=
1
;
_remotableDataService
=
workspace
.
Services
.
GetService
<
I
SolutionSynchronization
Service
>();
_remotableDataService
=
workspace
.
Services
.
GetService
<
I
RemotableData
Service
>();
// cancellation will be removed once I get to cancellation refactoring
_source
=
new
CancellationTokenSource
();
...
...
src/VisualStudio/Core/Test.Next/Remote/RemoteHostClientServiceFactoryTests.cs
浏览文件 @
6f3b54f3
...
...
@@ -63,7 +63,7 @@ public async Task GlobalAssets()
// make sure client is ready
var
client
=
await
service
.
TryGetRemoteHostClientAsync
(
CancellationToken
.
None
);
var
checksumService
=
workspace
.
Services
.
GetService
<
I
SolutionSynchronization
Service
>();
var
checksumService
=
workspace
.
Services
.
GetService
<
I
RemotableData
Service
>();
var
asset
=
checksumService
.
GetGlobalAsset
(
analyzerReference
,
CancellationToken
.
None
);
Assert
.
NotNull
(
asset
);
...
...
src/VisualStudio/Core/Test.Next/Services/VisualStudioDiagnosticAnalyzerExecutorTests.cs
浏览文件 @
6f3b54f3
...
...
@@ -139,7 +139,7 @@ void Method()
var
analyzerReference
=
new
AnalyzerFileReference
(
analyzerType
.
Assembly
.
Location
,
new
TestAnalyzerAssemblyLoader
());
// add host analyzer as global assets
var
snapshotService
=
workspace
.
Services
.
GetService
<
I
SolutionSynchronization
Service
>();
var
snapshotService
=
workspace
.
Services
.
GetService
<
I
RemotableData
Service
>();
var
assetBuilder
=
new
CustomAssetBuilder
(
workspace
);
var
asset
=
assetBuilder
.
Build
(
analyzerReference
,
CancellationToken
.
None
);
...
...
src/Workspaces/Core/Portable/Execution/CustomAsset.cs
浏览文件 @
6f3b54f3
...
...
@@ -10,7 +10,7 @@
namespace
Microsoft.CodeAnalysis.Execution
{
/// <summary>
/// Asset that is not part of solution, but want to participate in <see cref="I
SolutionSynchronization
Service"/>
/// Asset that is not part of solution, but want to participate in <see cref="I
RemotableData
Service"/>
/// </summary>
internal
abstract
class
CustomAsset
:
RemotableData
{
...
...
src/Workspaces/Core/Portable/Execution/CustomAssetBuilder.cs
浏览文件 @
6f3b54f3
...
...
@@ -9,7 +9,7 @@
namespace
Microsoft.CodeAnalysis.Execution
{
/// <summary>
/// builder to create custom asset which is not part of solution but want to participate in <see cref="I
SolutionSynchronization
Service"/>
/// builder to create custom asset which is not part of solution but want to participate in <see cref="I
RemotableData
Service"/>
/// </summary>
internal
class
CustomAssetBuilder
{
...
...
src/Workspaces/Core/Portable/Execution/ISolutionSynchronizationService.cs
浏览文件 @
6f3b54f3
...
...
@@ -12,7 +12,7 @@ namespace Microsoft.CodeAnalysis.Execution
/// a service that lets one to create <see cref="PinnedRemotableDataScope"/> that can be used to pin solution
/// while working on remote host
/// </summary>
internal
interface
I
SolutionSynchronization
Service
:
IWorkspaceService
internal
interface
I
RemotableData
Service
:
IWorkspaceService
{
/// <summary>
/// Add global <see cref="CustomAsset"/> which stays alive while host is alive.
...
...
src/Workspaces/Core/Portable/Execution/RemotableData.cs
浏览文件 @
6f3b54f3
...
...
@@ -8,7 +8,7 @@
namespace
Microsoft.CodeAnalysis.Execution
{
/// <summary>
/// Base for object that will use <see cref="I
SolutionSynchronization
Service"/> framework to synchronize data to remote host
/// Base for object that will use <see cref="I
RemotableData
Service"/> framework to synchronize data to remote host
/// </summary>
internal
abstract
partial
class
RemotableData
{
...
...
src/Workspaces/Core/Portable/Execution/SolutionSynchronizationService.cs
浏览文件 @
6f3b54f3
...
...
@@ -11,8 +11,8 @@
namespace
Microsoft.CodeAnalysis.Execution
{
[
ExportWorkspaceServiceFactory
(
typeof
(
I
SolutionSynchronization
Service
)),
Shared
]
internal
class
SolutionSynchronization
ServiceFactory
:
IWorkspaceServiceFactory
[
ExportWorkspaceServiceFactory
(
typeof
(
I
RemotableData
Service
)),
Shared
]
internal
class
RemotableData
ServiceFactory
:
IWorkspaceServiceFactory
{
private
readonly
AssetStorages
_assetStorages
=
new
AssetStorages
();
...
...
@@ -21,7 +21,7 @@ public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices)
return
new
Service
(
workspaceServices
,
_assetStorages
);
}
internal
class
Service
:
I
SolutionSynchronization
Service
internal
class
Service
:
I
RemotableData
Service
{
private
readonly
HostWorkspaceServices
_workspaceServices
;
private
readonly
AssetStorages
_assetStorages
;
...
...
src/Workspaces/Core/Portable/Remote/RemoteHostClientExtensions.cs
浏览文件 @
6f3b54f3
...
...
@@ -238,7 +238,7 @@ public static async Task<PinnedRemotableDataScope> GetPinnedScopeAsync(this Solu
{
Contract
.
ThrowIfNull
(
solution
);
var
service
=
solution
.
Workspace
.
Services
.
GetService
<
I
SolutionSynchronization
Service
>();
var
service
=
solution
.
Workspace
.
Services
.
GetService
<
I
RemotableData
Service
>();
return
await
service
.
CreatePinnedRemotableDataScopeAsync
(
solution
,
cancellationToken
).
ConfigureAwait
(
false
);
}
...
...
src/Workspaces/CoreTest/Execution/Extensions.cs
浏览文件 @
6f3b54f3
...
...
@@ -15,9 +15,9 @@ namespace Microsoft.CodeAnalysis.UnitTests.Execution
{
internal
static
class
Extensions
{
public
static
async
Task
<
T
>
GetValueAsync
<
T
>(
this
I
SolutionSynchronization
Service
service
,
Checksum
checksum
)
public
static
async
Task
<
T
>
GetValueAsync
<
T
>(
this
I
RemotableData
Service
service
,
Checksum
checksum
)
{
var
syncService
=
(
SolutionSynchronization
ServiceFactory
.
Service
)
service
;
var
syncService
=
(
RemotableData
ServiceFactory
.
Service
)
service
;
var
syncObject
=
syncService
.
GetRemotableData_TestOnly
(
checksum
,
CancellationToken
.
None
);
using
(
var
stream
=
SerializableBytes
.
CreateWritableStream
())
...
...
@@ -36,17 +36,17 @@ public static async Task<T> GetValueAsync<T>(this ISolutionSynchronizationServic
}
}
public
static
ChecksumObjectCollection
<
ProjectStateChecksums
>
ToProjectObjects
(
this
ProjectChecksumCollection
collection
,
I
SolutionSynchronization
Service
service
)
public
static
ChecksumObjectCollection
<
ProjectStateChecksums
>
ToProjectObjects
(
this
ProjectChecksumCollection
collection
,
I
RemotableData
Service
service
)
{
return
new
ChecksumObjectCollection
<
ProjectStateChecksums
>(
service
,
collection
);
}
public
static
ChecksumObjectCollection
<
DocumentStateChecksums
>
ToDocumentObjects
(
this
DocumentChecksumCollection
collection
,
I
SolutionSynchronization
Service
service
)
public
static
ChecksumObjectCollection
<
DocumentStateChecksums
>
ToDocumentObjects
(
this
DocumentChecksumCollection
collection
,
I
RemotableData
Service
service
)
{
return
new
ChecksumObjectCollection
<
DocumentStateChecksums
>(
service
,
collection
);
}
public
static
ChecksumObjectCollection
<
DocumentStateChecksums
>
ToDocumentObjects
(
this
TextDocumentChecksumCollection
collection
,
I
SolutionSynchronization
Service
service
)
public
static
ChecksumObjectCollection
<
DocumentStateChecksums
>
ToDocumentObjects
(
this
TextDocumentChecksumCollection
collection
,
I
RemotableData
Service
service
)
{
return
new
ChecksumObjectCollection
<
DocumentStateChecksums
>(
service
,
collection
);
}
...
...
@@ -59,7 +59,7 @@ internal class ChecksumObjectCollection<T> : RemotableData, IEnumerable<T> where
{
public
ImmutableArray
<
T
>
Children
{
get
;
}
public
ChecksumObjectCollection
(
I
SolutionSynchronization
Service
service
,
ChecksumCollection
collection
)
:
base
(
collection
.
Checksum
,
collection
.
GetWellKnownSynchronizationKind
())
public
ChecksumObjectCollection
(
I
RemotableData
Service
service
,
ChecksumCollection
collection
)
:
base
(
collection
.
Checksum
,
collection
.
GetWellKnownSynchronizationKind
())
{
// using .Result here since we don't want to convert all calls to this to async.
// and none of ChecksumWithChildren actually use async
...
...
src/Workspaces/CoreTest/Execution/SnapshotSerializationTestBase.cs
浏览文件 @
6f3b54f3
...
...
@@ -36,7 +36,7 @@ internal static Solution CreateFullSolution(HostServices hostServices = null)
return
textDocument1
.
Project
.
Solution
;
}
internal
static
async
Task
VerifyAssetAsync
(
I
SolutionSynchronization
Service
service
,
SolutionStateChecksums
solutionObject
)
internal
static
async
Task
VerifyAssetAsync
(
I
RemotableData
Service
service
,
SolutionStateChecksums
solutionObject
)
{
await
VerifyAssetSerializationAsync
<
SolutionInfo
.
SolutionAttributes
>(
service
,
solutionObject
.
Info
,
WellKnownSynchronizationKind
.
SolutionAttributes
,
...
...
@@ -49,7 +49,7 @@ internal static async Task VerifyAssetAsync(ISolutionSynchronizationService serv
}
}
internal
static
async
Task
VerifyAssetAsync
(
I
SolutionSynchronization
Service
service
,
ProjectStateChecksums
projectObject
)
internal
static
async
Task
VerifyAssetAsync
(
I
RemotableData
Service
service
,
ProjectStateChecksums
projectObject
)
{
var
info
=
await
VerifyAssetSerializationAsync
<
ProjectInfo
.
ProjectAttributes
>(
service
,
projectObject
.
Info
,
WellKnownSynchronizationKind
.
ProjectAttributes
,
...
...
@@ -97,7 +97,7 @@ internal static async Task VerifyAssetAsync(ISolutionSynchronizationService serv
}
}
internal
static
async
Task
VerifyAssetAsync
(
I
SolutionSynchronization
Service
service
,
DocumentStateChecksums
documentObject
)
internal
static
async
Task
VerifyAssetAsync
(
I
RemotableData
Service
service
,
DocumentStateChecksums
documentObject
)
{
var
info
=
await
VerifyAssetSerializationAsync
<
DocumentInfo
.
DocumentAttributes
>(
service
,
documentObject
.
Info
,
WellKnownSynchronizationKind
.
DocumentAttributes
,
...
...
@@ -109,13 +109,13 @@ internal static async Task VerifyAssetAsync(ISolutionSynchronizationService serv
}
internal
static
async
Task
<
T
>
VerifyAssetSerializationAsync
<
T
>(
I
SolutionSynchronization
Service
service
,
I
RemotableData
Service
service
,
Checksum
checksum
,
WellKnownSynchronizationKind
kind
,
Func
<
T
,
WellKnownSynchronizationKind
,
Serializer
,
RemotableData
>
assetGetter
)
{
// re-create asset from object
var
syncService
=
(
SolutionSynchronization
ServiceFactory
.
Service
)
service
;
var
syncService
=
(
RemotableData
ServiceFactory
.
Service
)
service
;
var
syncObject
=
syncService
.
GetRemotableData_TestOnly
(
checksum
,
CancellationToken
.
None
);
var
recoveredValue
=
await
service
.
GetValueAsync
<
T
>(
checksum
);
...
...
@@ -127,7 +127,7 @@ internal static async Task VerifyAssetAsync(ISolutionSynchronizationService serv
return
recoveredValue
;
}
internal
static
async
Task
VerifySolutionStateSerializationAsync
(
I
SolutionSynchronization
Service
service
,
Solution
solution
,
Checksum
solutionChecksum
)
internal
static
async
Task
VerifySolutionStateSerializationAsync
(
I
RemotableData
Service
service
,
Solution
solution
,
Checksum
solutionChecksum
)
{
var
solutionObjectFromSyncObject
=
await
service
.
GetValueAsync
<
SolutionStateChecksums
>(
solutionChecksum
);
Assert
.
True
(
solution
.
State
.
TryGetStateChecksums
(
out
var
solutionObjectFromSolution
));
...
...
@@ -135,14 +135,14 @@ internal static async Task VerifySolutionStateSerializationAsync(ISolutionSynchr
SolutionStateEqual
(
service
,
solutionObjectFromSolution
,
solutionObjectFromSyncObject
);
}
internal
static
void
SolutionStateEqual
(
I
SolutionSynchronization
Service
service
,
SolutionStateChecksums
solutionObject1
,
SolutionStateChecksums
solutionObject2
)
internal
static
void
SolutionStateEqual
(
I
RemotableData
Service
service
,
SolutionStateChecksums
solutionObject1
,
SolutionStateChecksums
solutionObject2
)
{
ChecksumWithChildrenEqual
(
solutionObject1
,
solutionObject2
);
ProjectStatesEqual
(
service
,
solutionObject1
.
Projects
.
ToProjectObjects
(
service
),
solutionObject2
.
Projects
.
ToProjectObjects
(
service
));
}
internal
static
void
ProjectStateEqual
(
I
SolutionSynchronization
Service
service
,
ProjectStateChecksums
projectObjects1
,
ProjectStateChecksums
projectObjects2
)
internal
static
void
ProjectStateEqual
(
I
RemotableData
Service
service
,
ProjectStateChecksums
projectObjects1
,
ProjectStateChecksums
projectObjects2
)
{
ChecksumWithChildrenEqual
(
projectObjects1
,
projectObjects2
);
...
...
@@ -150,7 +150,7 @@ internal static void ProjectStateEqual(ISolutionSynchronizationService service,
ChecksumWithChildrenEqual
(
projectObjects1
.
AdditionalDocuments
.
ToDocumentObjects
(
service
),
projectObjects2
.
AdditionalDocuments
.
ToDocumentObjects
(
service
));
}
internal
static
void
ProjectStatesEqual
(
I
SolutionSynchronization
Service
service
,
ChecksumObjectCollection
<
ProjectStateChecksums
>
projectObjects1
,
ChecksumObjectCollection
<
ProjectStateChecksums
>
projectObjects2
)
internal
static
void
ProjectStatesEqual
(
I
RemotableData
Service
service
,
ChecksumObjectCollection
<
ProjectStateChecksums
>
projectObjects1
,
ChecksumObjectCollection
<
ProjectStateChecksums
>
projectObjects2
)
{
SynchronizationObjectEqual
(
projectObjects1
,
projectObjects2
);
...
...
@@ -197,7 +197,7 @@ internal static void ChecksumWithChildrenEqual(ChecksumWithChildren checksums1,
}
internal
static
void
VerifySnapshotInService
(
I
SolutionSynchronization
Service
snapshotService
,
I
RemotableData
Service
snapshotService
,
ProjectStateChecksums
projectObject
,
int
expectedDocumentCount
,
int
expectedProjectReferenceCount
,
...
...
@@ -219,7 +219,7 @@ internal static void ChecksumWithChildrenEqual(ChecksumWithChildren checksums1,
VerifyCollectionInService
(
snapshotService
,
projectObject
.
AdditionalDocuments
.
ToDocumentObjects
(
snapshotService
),
expectedAdditionalDocumentCount
);
}
internal
static
void
VerifyCollectionInService
(
I
SolutionSynchronization
Service
snapshotService
,
ChecksumCollection
checksums
,
int
expectedCount
,
WellKnownSynchronizationKind
expectedItemKind
)
internal
static
void
VerifyCollectionInService
(
I
RemotableData
Service
snapshotService
,
ChecksumCollection
checksums
,
int
expectedCount
,
WellKnownSynchronizationKind
expectedItemKind
)
{
VerifyChecksumInService
(
snapshotService
,
checksums
.
Checksum
,
checksums
.
GetWellKnownSynchronizationKind
());
Assert
.
Equal
(
checksums
.
Count
,
expectedCount
);
...
...
@@ -230,7 +230,7 @@ internal static void VerifyCollectionInService(ISolutionSynchronizationService s
}
}
internal
static
void
VerifyCollectionInService
(
I
SolutionSynchronization
Service
snapshotService
,
ChecksumObjectCollection
<
DocumentStateChecksums
>
documents
,
int
expectedCount
)
internal
static
void
VerifyCollectionInService
(
I
RemotableData
Service
snapshotService
,
ChecksumObjectCollection
<
DocumentStateChecksums
>
documents
,
int
expectedCount
)
{
VerifySynchronizationObjectInService
(
snapshotService
,
documents
);
Assert
.
Equal
(
documents
.
Count
,
expectedCount
);
...
...
@@ -241,22 +241,22 @@ internal static void VerifyCollectionInService(ISolutionSynchronizationService s
}
}
internal
static
void
VerifySnapshotInService
(
I
SolutionSynchronization
Service
snapshotService
,
DocumentStateChecksums
documentObject
)
internal
static
void
VerifySnapshotInService
(
I
RemotableData
Service
snapshotService
,
DocumentStateChecksums
documentObject
)
{
VerifyChecksumInService
(
snapshotService
,
documentObject
.
Checksum
,
documentObject
.
GetWellKnownSynchronizationKind
());
VerifyChecksumInService
(
snapshotService
,
documentObject
.
Info
,
WellKnownSynchronizationKind
.
DocumentAttributes
);
VerifyChecksumInService
(
snapshotService
,
documentObject
.
Text
,
WellKnownSynchronizationKind
.
SourceText
);
}
internal
static
void
VerifySynchronizationObjectInService
<
T
>(
I
SolutionSynchronization
Service
snapshotService
,
T
syncObject
)
where
T
:
RemotableData
internal
static
void
VerifySynchronizationObjectInService
<
T
>(
I
RemotableData
Service
snapshotService
,
T
syncObject
)
where
T
:
RemotableData
{
VerifyChecksumInService
(
snapshotService
,
syncObject
.
Checksum
,
syncObject
.
Kind
);
}
internal
static
void
VerifyChecksumInService
(
I
SolutionSynchronization
Service
snapshotService
,
Checksum
checksum
,
WellKnownSynchronizationKind
kind
)
internal
static
void
VerifyChecksumInService
(
I
RemotableData
Service
snapshotService
,
Checksum
checksum
,
WellKnownSynchronizationKind
kind
)
{
Assert
.
NotNull
(
checksum
);
var
service
=
(
SolutionSynchronization
ServiceFactory
.
Service
)
snapshotService
;
var
service
=
(
RemotableData
ServiceFactory
.
Service
)
snapshotService
;
var
otherObject
=
service
.
GetRemotableData_TestOnly
(
checksum
,
CancellationToken
.
None
);
ChecksumEqual
(
checksum
,
kind
,
otherObject
.
Checksum
,
otherObject
.
Kind
);
...
...
src/Workspaces/CoreTest/Execution/SnapshotSerializationTests.cs
浏览文件 @
6f3b54f3
...
...
@@ -33,7 +33,7 @@ public async Task CreateSolutionSnapshotId_Empty()
{
var
solution
=
new
AdhocWorkspace
().
CurrentSolution
;
var
snapshotService
=
(
new
SolutionSynchronizationServiceFactory
()).
CreateService
(
solution
.
Workspace
.
Services
)
as
ISolutionSynchronization
Service
;
var
snapshotService
=
(
new
RemotableDataServiceFactory
()).
CreateService
(
solution
.
Workspace
.
Services
)
as
IRemotableData
Service
;
using
(
var
snapshot
=
await
snapshotService
.
CreatePinnedRemotableDataScopeAsync
(
solution
,
CancellationToken
.
None
).
ConfigureAwait
(
false
))
{
var
checksum
=
snapshot
.
SolutionChecksum
;
...
...
@@ -56,7 +56,7 @@ public async Task CreateSolutionSnapshotId_Empty_Serialization()
{
var
solution
=
new
AdhocWorkspace
().
CurrentSolution
;
var
snapshotService
=
(
new
SolutionSynchronizationServiceFactory
()).
CreateService
(
solution
.
Workspace
.
Services
)
as
ISolutionSynchronization
Service
;
var
snapshotService
=
(
new
RemotableDataServiceFactory
()).
CreateService
(
solution
.
Workspace
.
Services
)
as
IRemotableData
Service
;
using
(
var
snapshot
=
await
snapshotService
.
CreatePinnedRemotableDataScopeAsync
(
solution
,
CancellationToken
.
None
).
ConfigureAwait
(
false
))
{
await
VerifySolutionStateSerializationAsync
(
snapshotService
,
solution
,
snapshot
.
SolutionChecksum
).
ConfigureAwait
(
false
);
...
...
@@ -68,7 +68,7 @@ public async Task CreateSolutionSnapshotId_Project()
{
var
project
=
new
AdhocWorkspace
().
CurrentSolution
.
AddProject
(
"Project"
,
"Project.dll"
,
LanguageNames
.
CSharp
);
var
snapshotService
=
(
new
SolutionSynchronizationServiceFactory
()).
CreateService
(
project
.
Solution
.
Workspace
.
Services
)
as
ISolutionSynchronization
Service
;
var
snapshotService
=
(
new
RemotableDataServiceFactory
()).
CreateService
(
project
.
Solution
.
Workspace
.
Services
)
as
IRemotableData
Service
;
using
(
var
snapshot
=
await
snapshotService
.
CreatePinnedRemotableDataScopeAsync
(
project
.
Solution
,
CancellationToken
.
None
).
ConfigureAwait
(
false
))
{
var
checksum
=
snapshot
.
SolutionChecksum
;
...
...
@@ -93,7 +93,7 @@ public async Task CreateSolutionSnapshotId_Project_Serialization()
{
var
project
=
new
AdhocWorkspace
().
CurrentSolution
.
AddProject
(
"Project"
,
"Project.dll"
,
LanguageNames
.
CSharp
);
var
snapshotService
=
(
new
SolutionSynchronizationServiceFactory
()).
CreateService
(
project
.
Solution
.
Workspace
.
Services
)
as
ISolutionSynchronization
Service
;
var
snapshotService
=
(
new
RemotableDataServiceFactory
()).
CreateService
(
project
.
Solution
.
Workspace
.
Services
)
as
IRemotableData
Service
;
using
(
var
snapshot
=
await
snapshotService
.
CreatePinnedRemotableDataScopeAsync
(
project
.
Solution
,
CancellationToken
.
None
).
ConfigureAwait
(
false
))
{
await
VerifySolutionStateSerializationAsync
(
snapshotService
,
project
.
Solution
,
snapshot
.
SolutionChecksum
).
ConfigureAwait
(
false
);
...
...
@@ -107,7 +107,7 @@ public async Task CreateSolutionSnapshotId()
var
document
=
new
AdhocWorkspace
().
CurrentSolution
.
AddProject
(
"Project"
,
"Project.dll"
,
LanguageNames
.
CSharp
).
AddDocument
(
"Document"
,
SourceText
.
From
(
code
));
var
snapshotService
=
(
new
SolutionSynchronizationServiceFactory
()).
CreateService
(
document
.
Project
.
Solution
.
Workspace
.
Services
)
as
ISolutionSynchronization
Service
;
var
snapshotService
=
(
new
RemotableDataServiceFactory
()).
CreateService
(
document
.
Project
.
Solution
.
Workspace
.
Services
)
as
IRemotableData
Service
;
using
(
var
snapshot
=
await
snapshotService
.
CreatePinnedRemotableDataScopeAsync
(
document
.
Project
.
Solution
,
CancellationToken
.
None
).
ConfigureAwait
(
false
))
{
var
syncObject
=
snapshot
.
GetRemotableData
(
snapshot
.
SolutionChecksum
,
CancellationToken
.
None
);
...
...
@@ -129,7 +129,7 @@ public async Task CreateSolutionSnapshotId_Serialization()
var
document
=
new
AdhocWorkspace
().
CurrentSolution
.
AddProject
(
"Project"
,
"Project.dll"
,
LanguageNames
.
CSharp
).
AddDocument
(
"Document"
,
SourceText
.
From
(
code
));
var
snapshotService
=
(
new
SolutionSynchronizationServiceFactory
()).
CreateService
(
document
.
Project
.
Solution
.
Workspace
.
Services
)
as
ISolutionSynchronization
Service
;
var
snapshotService
=
(
new
RemotableDataServiceFactory
()).
CreateService
(
document
.
Project
.
Solution
.
Workspace
.
Services
)
as
IRemotableData
Service
;
using
(
var
snapshot
=
await
snapshotService
.
CreatePinnedRemotableDataScopeAsync
(
document
.
Project
.
Solution
,
CancellationToken
.
None
).
ConfigureAwait
(
false
))
{
await
VerifySolutionStateSerializationAsync
(
snapshotService
,
document
.
Project
.
Solution
,
snapshot
.
SolutionChecksum
).
ConfigureAwait
(
false
);
...
...
@@ -144,7 +144,7 @@ public async Task CreateSolutionSnapshotId_Full()
var
firstProjectChecksum
=
await
solution
.
GetProject
(
solution
.
ProjectIds
[
0
]).
State
.
GetChecksumAsync
(
CancellationToken
.
None
);
var
secondProjectChecksum
=
await
solution
.
GetProject
(
solution
.
ProjectIds
[
1
]).
State
.
GetChecksumAsync
(
CancellationToken
.
None
);
var
snapshotService
=
(
new
SolutionSynchronizationServiceFactory
()).
CreateService
(
solution
.
Workspace
.
Services
)
as
ISolutionSynchronization
Service
;
var
snapshotService
=
(
new
RemotableDataServiceFactory
()).
CreateService
(
solution
.
Workspace
.
Services
)
as
IRemotableData
Service
;
using
(
var
snapshot
=
await
snapshotService
.
CreatePinnedRemotableDataScopeAsync
(
solution
,
CancellationToken
.
None
).
ConfigureAwait
(
false
))
{
var
syncObject
=
snapshot
.
GetRemotableData
(
snapshot
.
SolutionChecksum
,
CancellationToken
.
None
);
...
...
@@ -167,7 +167,7 @@ public async Task CreateSolutionSnapshotId_Full_Serialization()
{
var
solution
=
CreateFullSolution
();
var
snapshotService
=
(
new
SolutionSynchronizationServiceFactory
()).
CreateService
(
solution
.
Workspace
.
Services
)
as
ISolutionSynchronization
Service
;
var
snapshotService
=
(
new
RemotableDataServiceFactory
()).
CreateService
(
solution
.
Workspace
.
Services
)
as
IRemotableData
Service
;
using
(
var
snapshot
=
await
snapshotService
.
CreatePinnedRemotableDataScopeAsync
(
solution
,
CancellationToken
.
None
).
ConfigureAwait
(
false
))
{
await
VerifySolutionStateSerializationAsync
(
snapshotService
,
solution
,
snapshot
.
SolutionChecksum
).
ConfigureAwait
(
false
);
...
...
@@ -179,7 +179,7 @@ public async Task CreateSolutionSnapshotId_Full_Asset_Serialization()
{
var
solution
=
CreateFullSolution
();
var
snapshotService
=
(
new
SolutionSynchronizationServiceFactory
()).
CreateService
(
solution
.
Workspace
.
Services
)
as
ISolutionSynchronization
Service
;
var
snapshotService
=
(
new
RemotableDataServiceFactory
()).
CreateService
(
solution
.
Workspace
.
Services
)
as
IRemotableData
Service
;
using
(
var
snapshot
=
await
snapshotService
.
CreatePinnedRemotableDataScopeAsync
(
solution
,
CancellationToken
.
None
).
ConfigureAwait
(
false
))
{
var
solutionObject
=
await
snapshotService
.
GetValueAsync
<
SolutionStateChecksums
>(
snapshot
.
SolutionChecksum
);
...
...
@@ -195,7 +195,7 @@ public async Task CreateSolutionSnapshotId_Full_Asset_Serialization_Desktop()
var
solution
=
CreateFullSolution
(
hostServices
);
var
snapshotService
=
(
new
SolutionSynchronizationServiceFactory
()).
CreateService
(
solution
.
Workspace
.
Services
)
as
ISolutionSynchronization
Service
;
var
snapshotService
=
(
new
RemotableDataServiceFactory
()).
CreateService
(
solution
.
Workspace
.
Services
)
as
IRemotableData
Service
;
using
(
var
snapshot
=
await
snapshotService
.
CreatePinnedRemotableDataScopeAsync
(
solution
,
CancellationToken
.
None
).
ConfigureAwait
(
false
))
{
var
solutionObject
=
await
snapshotService
.
GetValueAsync
<
SolutionStateChecksums
>(
snapshot
.
SolutionChecksum
);
...
...
@@ -213,7 +213,7 @@ public async Task CreateSolutionSnapshotId_Duplicate()
SolutionStateChecksums
solutionId1
;
SolutionStateChecksums
solutionId2
;
var
snapshotService
=
(
new
SolutionSynchronizationServiceFactory
()).
CreateService
(
solution
.
Workspace
.
Services
)
as
ISolutionSynchronization
Service
;
var
snapshotService
=
(
new
RemotableDataServiceFactory
()).
CreateService
(
solution
.
Workspace
.
Services
)
as
IRemotableData
Service
;
using
(
var
snapshot1
=
await
snapshotService
.
CreatePinnedRemotableDataScopeAsync
(
solution
,
CancellationToken
.
None
).
ConfigureAwait
(
false
))
{
solutionId1
=
await
snapshotService
.
GetValueAsync
<
SolutionStateChecksums
>(
snapshot1
.
SolutionChecksum
).
ConfigureAwait
(
false
);
...
...
@@ -250,7 +250,7 @@ public async Task Workspace_RoundTrip_Test()
{
var
solution
=
CreateFullSolution
();
var
snapshotService
=
(
new
SolutionSynchronizationServiceFactory
()).
CreateService
(
solution
.
Workspace
.
Services
)
as
ISolutionSynchronization
Service
;
var
snapshotService
=
(
new
RemotableDataServiceFactory
()).
CreateService
(
solution
.
Workspace
.
Services
)
as
IRemotableData
Service
;
var
snapshot1
=
await
snapshotService
.
CreatePinnedRemotableDataScopeAsync
(
solution
,
CancellationToken
.
None
).
ConfigureAwait
(
false
);
// recover solution from given snapshot
...
...
@@ -292,7 +292,7 @@ public async Task Workspace_RoundTrip_Test_Desktop()
var
solution
=
CreateFullSolution
(
hostServices
);
var
snapshotService
=
(
new
SolutionSynchronizationServiceFactory
()).
CreateService
(
solution
.
Workspace
.
Services
)
as
ISolutionSynchronization
Service
;
var
snapshotService
=
(
new
RemotableDataServiceFactory
()).
CreateService
(
solution
.
Workspace
.
Services
)
as
IRemotableData
Service
;
var
snapshot1
=
await
snapshotService
.
CreatePinnedRemotableDataScopeAsync
(
solution
,
CancellationToken
.
None
).
ConfigureAwait
(
false
);
// recover solution from given snapshot
...
...
@@ -455,7 +455,7 @@ public async Task SnapshotWithMissingReferencesTest()
project
=
project
.
AddMetadataReference
(
metadata
);
project
=
project
.
AddAnalyzerReference
(
analyzer
);
var
snapshotService
=
(
new
SolutionSynchronizationServiceFactory
()).
CreateService
(
project
.
Solution
.
Workspace
.
Services
)
as
ISolutionSynchronization
Service
;
var
snapshotService
=
(
new
RemotableDataServiceFactory
()).
CreateService
(
project
.
Solution
.
Workspace
.
Services
)
as
IRemotableData
Service
;
using
(
var
snapshot
=
await
snapshotService
.
CreatePinnedRemotableDataScopeAsync
(
project
.
Solution
,
CancellationToken
.
None
).
ConfigureAwait
(
false
))
{
// this shouldn't throw
...
...
@@ -470,7 +470,7 @@ public async Task UnknownLanguageTest()
var
project
=
new
AdhocWorkspace
(
hostServices
).
CurrentSolution
.
AddProject
(
"Project"
,
"Project.dll"
,
NullLanguageService
.
TestLanguage
);
var
snapshotService
=
(
new
SolutionSynchronizationServiceFactory
()).
CreateService
(
project
.
Solution
.
Workspace
.
Services
)
as
ISolutionSynchronization
Service
;
var
snapshotService
=
(
new
RemotableDataServiceFactory
()).
CreateService
(
project
.
Solution
.
Workspace
.
Services
)
as
IRemotableData
Service
;
using
(
var
snapshot
=
await
snapshotService
.
CreatePinnedRemotableDataScopeAsync
(
project
.
Solution
,
CancellationToken
.
None
).
ConfigureAwait
(
false
))
{
// this shouldn't throw
...
...
@@ -601,7 +601,7 @@ private async Task<string> GetXmlDocumentAsync(HostServices services)
.
AddMetadataReference
(
MetadataReference
.
CreateFromFile
(
tempCorlib
.
Path
))
.
Solution
;
var
snapshotService
=
(
new
SolutionSynchronizationServiceFactory
()).
CreateService
(
solution
.
Workspace
.
Services
)
as
ISolutionSynchronization
Service
;
var
snapshotService
=
(
new
RemotableDataServiceFactory
()).
CreateService
(
solution
.
Workspace
.
Services
)
as
IRemotableData
Service
;
using
(
var
scope
=
await
snapshotService
.
CreatePinnedRemotableDataScopeAsync
(
solution
,
CancellationToken
.
None
))
{
// recover solution from given snapshot
...
...
@@ -642,7 +642,7 @@ private static async Task VerifyOptionSetsAsync(Workspace workspace, string lang
}
}
private
async
Task
<
Solution
>
GetSolutionAsync
(
I
SolutionSynchronization
Service
service
,
PinnedRemotableDataScope
syncScope
)
private
async
Task
<
Solution
>
GetSolutionAsync
(
I
RemotableData
Service
service
,
PinnedRemotableDataScope
syncScope
)
{
var
workspace
=
new
AdhocWorkspace
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录