提交 a12cd32b 编写于 作者: H Heejae Chang

refactored based on PR feedback.

上级 496f30f1
......@@ -367,8 +367,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServicesVisualStudio.Next",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VisualStudioTest.Next", "src\VisualStudio\Core\Test.Next\VisualStudioTest.Next.csproj", "{2E1658E2-5045-4F85-A64C-C0ECCD39F719}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestUtilities.Workspaces", "src\Workspaces\TestUtilities.Workspace\TestUtilities.Workspaces.csproj", "{78324E87-92D5-412C-9FA8-5CC2FBFBAF6C}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
src\Compilers\Core\CommandLine\CommandLine.projitems*{06b26dcb-7a12-48ef-ae50-708593abd05f}*SharedItemsImports = 4
......@@ -3182,26 +3180,6 @@ Global
{2E1658E2-5045-4F85-A64C-C0ECCD39F719}.Release|x64.Build.0 = Release|Any CPU
{2E1658E2-5045-4F85-A64C-C0ECCD39F719}.Release|x86.ActiveCfg = Release|Any CPU
{2E1658E2-5045-4F85-A64C-C0ECCD39F719}.Release|x86.Build.0 = Release|Any CPU
{78324E87-92D5-412C-9FA8-5CC2FBFBAF6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{78324E87-92D5-412C-9FA8-5CC2FBFBAF6C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{78324E87-92D5-412C-9FA8-5CC2FBFBAF6C}.Debug|ARM.ActiveCfg = Debug|Any CPU
{78324E87-92D5-412C-9FA8-5CC2FBFBAF6C}.Debug|ARM.Build.0 = Debug|Any CPU
{78324E87-92D5-412C-9FA8-5CC2FBFBAF6C}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{78324E87-92D5-412C-9FA8-5CC2FBFBAF6C}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{78324E87-92D5-412C-9FA8-5CC2FBFBAF6C}.Debug|x64.ActiveCfg = Debug|Any CPU
{78324E87-92D5-412C-9FA8-5CC2FBFBAF6C}.Debug|x64.Build.0 = Debug|Any CPU
{78324E87-92D5-412C-9FA8-5CC2FBFBAF6C}.Debug|x86.ActiveCfg = Debug|Any CPU
{78324E87-92D5-412C-9FA8-5CC2FBFBAF6C}.Debug|x86.Build.0 = Debug|Any CPU
{78324E87-92D5-412C-9FA8-5CC2FBFBAF6C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{78324E87-92D5-412C-9FA8-5CC2FBFBAF6C}.Release|Any CPU.Build.0 = Release|Any CPU
{78324E87-92D5-412C-9FA8-5CC2FBFBAF6C}.Release|ARM.ActiveCfg = Release|Any CPU
{78324E87-92D5-412C-9FA8-5CC2FBFBAF6C}.Release|ARM.Build.0 = Release|Any CPU
{78324E87-92D5-412C-9FA8-5CC2FBFBAF6C}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{78324E87-92D5-412C-9FA8-5CC2FBFBAF6C}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{78324E87-92D5-412C-9FA8-5CC2FBFBAF6C}.Release|x64.ActiveCfg = Release|Any CPU
{78324E87-92D5-412C-9FA8-5CC2FBFBAF6C}.Release|x64.Build.0 = Release|Any CPU
{78324E87-92D5-412C-9FA8-5CC2FBFBAF6C}.Release|x86.ActiveCfg = Release|Any CPU
{78324E87-92D5-412C-9FA8-5CC2FBFBAF6C}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......@@ -3371,6 +3349,5 @@ Global
{7259740A-FD0E-480F-A7D4-08BE90AC9051} = {8DBA5174-B0AA-4561-82B1-A46607697753}
{FE0D4BDD-1C30-488E-A870-854F5B8C5014} = {8DBA5174-B0AA-4561-82B1-A46607697753}
{2E1658E2-5045-4F85-A64C-C0ECCD39F719} = {8DBA5174-B0AA-4561-82B1-A46607697753}
{78324E87-92D5-412C-9FA8-5CC2FBFBAF6C} = {55A62CFA-1155-46F1-ADF3-BEEE51B58AB5}
EndGlobalSection
EndGlobal
......@@ -41,6 +41,10 @@
<Project>{5f8d2414-064a-4b3a-9b42-8e2a04246be5}</Project>
<Name>Workspaces</Name>
</ProjectReference>
<ProjectReference Include="..\..\Workspaces\Remote\ServiceHub\ServiceHub.csproj">
<Project>{80fddd00-9393-47f7-8baf-7e87ce011068}</Project>
<Name>ServiceHub</Name>
</ProjectReference>
<ProjectReference Include="..\Core\EditorFeatures.csproj">
<Project>{3CDEEAB7-2256-418A-BEB2-620B5CB16302}</Project>
<Name>EditorFeatures</Name>
......@@ -59,6 +63,12 @@
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\visualstudio\core\next\remote\JsonRpcClient.cs">
<Link>Remote\JsonRpcClient.cs</Link>
</Compile>
<Compile Include="..\..\visualstudio\core\next\remote\JsonRpcSession.cs">
<Link>Remote\JsonRpcSession.cs</Link>
</Compile>
<Compile Include="Async\AsynchronousOperationBlocker.cs" />
<Compile Include="Async\Checkpoint.cs" />
<Compile Include="Async\WaitHelper.cs" />
......@@ -66,6 +76,7 @@
<Compile Include="DispatcherExtensions.cs" />
<Compile Include="DirectoryExtensions.cs" />
<Compile Include="ExceptionUtilities.cs" />
<Compile Include="Remote\InProcRemostHostClient.cs" />
<Compile Include="Threading\ConditionalWpfFactAttribute.cs" />
<Compile Include="Threading\StaTaskScheduler.cs" />
<Compile Include="Threading\WpfFactAttribute.cs" />
......@@ -75,6 +86,7 @@
<Compile Include="VisualStudioSendKeys.cs" />
</ItemGroup>
<ItemGroup>
<InternalsVisibleTo Include="Roslyn.VisualStudio.RemoteHostClientMock" />
<InternalsVisibleToTest Include="Roslyn.Compilers.CSharp.CommandLine.UnitTests" />
<InternalsVisibleToTest Include="Roslyn.Compilers.CSharp.Emit.UnitTests" />
<InternalsVisibleToTest Include="Roslyn.Compilers.CSharp.EnC.UnitTests" />
......@@ -93,10 +105,11 @@
<InternalsVisibleToTest Include="Roslyn.InteractiveHost.UnitTests" />
<InternalsVisibleToTest Include="Roslyn.Services.Editor.UnitTests" />
<InternalsVisibleToTest Include="Roslyn.VisualStudio.Test.Utilities" />
<InternalsVisibleToTest Include="Roslyn.VisualStudio.Next.UnitTests" />
</ItemGroup>
<ItemGroup>
<None Include="project.json" />
</ItemGroup>
<Import Project="..\..\..\build\Targets\VSL.Imports.targets" />
<Import Project="..\..\..\build\Targets\Roslyn.Toolsets.Xunit.targets" />
</Project>
</Project>
\ No newline at end of file
{
"dependencies": {
"xunit": "2.1.0",
"xunit.runner.console": "2.2.0-beta1-build3239"
},
"frameworks": {
"net46": { }
}
"dependencies": {
"xunit": "2.1.0",
"xunit.runner.console": "2.2.0-beta1-build3239",
"Newtonsoft.Json": "8.0.3",
"Nerdbank.FullDuplexStream": "1.0.1"
},
"frameworks": {
"net46": { }
}
}
\ No newline at end of file
......@@ -62,10 +62,6 @@
<Project>{80fddd00-9393-47f7-8baf-7e87ce011068}</Project>
<Name>ServiceHub</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Workspaces\TestUtilities.Workspace\TestUtilities.Workspaces.csproj">
<Project>{78324e87-92d5-412c-9fa8-5cc2fbfbaf6c}</Project>
<Name>TestUtilities.Workspaces</Name>
</ProjectReference>
<ProjectReference Include="..\..\Core\Test\ServicesVisualStudioTest.vbproj">
<Project>{A1455D30-55FC-45EF-8759-3AEBDB13D940}</Project>
<Name>ServicesVisualStudioTest</Name>
......
......@@ -25,6 +25,10 @@
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
</PropertyGroup>
<ItemGroup Label="Project References">
<ProjectReference Include="..\..\EditorFeatures\TestUtilities\ServicesTestUtilities.csproj">
<Project>{76c6f005-c89d-4348-bb4a-39189ddbeb52}</Project>
<Name>ServicesTestUtilities</Name>
</ProjectReference>
<ProjectReference Include="..\..\VisualStudio\Core\Def\ServicesVisualStudio.csproj">
<Project>{86FD5B9A-4FA0-4B10-B59F-CFAF077A859C}</Project>
<Name>ServicesVisualStudio</Name>
......@@ -46,10 +50,6 @@
<Name>ServiceHub</Name>
<IncludeOutputGroupsInVSIX>BuiltProjectOutputGroup%3b</IncludeOutputGroupsInVSIX>
</ProjectReference>
<ProjectReference Include="..\..\Workspaces\TestUtilities.Workspace\TestUtilities.Workspaces.csproj">
<Project>{78324e87-92d5-412c-9fa8-5cc2fbfbaf6c}</Project>
<Name>TestUtilities.Workspaces</Name>
</ProjectReference>
<ProjectReference Include="..\Core\Next\ServicesVisualStudio.Next.csproj">
<Project>{fe0d4bdd-1c30-488e-a870-854f5b8c5014}</Project>
<Name>ServicesVisualStudio.Next</Name>
......
......@@ -10,7 +10,7 @@ internal partial class DefaultRemoteHostClientServiceFactory
{
public class RemoteHostClientService : IRemoteHostClientService
{
private readonly Task<RemoteHostClient> _instanceTask;
private readonly AsyncLazy<RemoteHostClient> _lazyInstance;
public RemoteHostClientService(Workspace workspace)
{
......@@ -21,20 +21,17 @@ public RemoteHostClientService(Workspace workspace)
return;
}
_instanceTask = Task.Run(() => remoteHostClientFactory.CreateAsync(workspace, CancellationToken.None), CancellationToken.None);
_lazyInstance = new AsyncLazy<RemoteHostClient>(c => remoteHostClientFactory.CreateAsync(workspace, c), cacheResult: true);
}
public Task<RemoteHostClient> GetRemoteHostClientAsync(CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
if (_instanceTask == null)
if (_lazyInstance == null)
{
// service is in shutdown mode or not enabled
return SpecializedTasks.Default<RemoteHostClient>();
}
return _instanceTask;
return _lazyInstance.GetValueAsync(cancellationToken);
}
}
}
......
......@@ -276,7 +276,6 @@
<InternalsVisibleToTest Include="Roslyn.Services.UnitTests" />
<InternalsVisibleToTest Include="Roslyn.Services.CSharp.UnitTests" />
<InternalsVisibleToTest Include="Roslyn.Services.VisualBasic.UnitTests" />
<InternalsVisibleToTest Include="Roslyn.Test.Utilities.Desktop" />
<InternalsVisibleToTest Include="Roslyn.VisualStudio.CSharp.UnitTests" />
<InternalsVisibleToTest Include="Roslyn.VisualStudio.Closed.UnitTests" />
<InternalsVisibleToTest Include="Roslyn.VisualStudio.Test.Setup" />
......
......@@ -70,7 +70,7 @@
</ItemGroup>
<ItemGroup>
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.TestImpact.BuildManager" />
<InternalsVisibleToTest Include="Roslyn.Test.Utilities.Workspaces" />
<InternalsVisibleToTest Include="Roslyn.Services.Test.Utilities" />
<InternalsVisibleToTest Include="Roslyn.VisualStudio.Next.UnitTests" />
</ItemGroup>
<ItemGroup>
......
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\..\build\Targets\VSL.Settings.targets" />
<PropertyGroup>
<ProjectGuid>{78324E87-92D5-412C-9FA8-5CC2FBFBAF6C}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Roslyn.Test.Utilities.Workspaces</RootNamespace>
<AssemblyName>Roslyn.Test.Utilities.Workspaces</AssemblyName>
<PlatformTarget>x86</PlatformTarget>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<Nonshipping>true</Nonshipping>
</PropertyGroup>
<PropertyGroup>
<IncludeFrameworkReferencesFromNuGet>false</IncludeFrameworkReferencesFromNuGet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\VisualStudio\Core\Next\Remote\JsonRpcClient.cs">
<Link>Remote\JsonRpcClient.cs</Link>
</Compile>
<Compile Include="..\..\VisualStudio\Core\Next\Remote\JsonRpcSession.cs">
<Link>Remote\JsonRpcSession.cs</Link>
</Compile>
<Compile Include="Remote\InProcRemostHostClient.cs" />
</ItemGroup>
<ItemGroup>
<None Include="project.json" />
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
<InternalsVisibleTo Include="Roslyn.VisualStudio.RemoteHostClientMock" />
<InternalsVisibleToTest Include="Roslyn.VisualStudio.Next.UnitTests" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Workspaces\Core\Portable\Workspaces.csproj">
<Project>{5f8d2414-064a-4b3a-9b42-8e2a04246be5}</Project>
<Name>Workspaces</Name>
</ProjectReference>
<ProjectReference Include="..\..\Workspaces\Remote\ServiceHub\ServiceHub.csproj">
<Project>{80fddd00-9393-47f7-8baf-7e87ce011068}</Project>
<Name>ServiceHub</Name>
<Aliases>global,hub</Aliases>
</ProjectReference>
</ItemGroup>
<ItemGroup />
<Import Project="..\..\..\build\Targets\VSL.Imports.targets" />
</Project>
\ No newline at end of file
{
"dependencies": {
"Newtonsoft.Json": "8.0.3",
"Nerdbank.FullDuplexStream": "1.0.1"
},
"frameworks": {
"net46": { }
},
"runtimes": {
"win7": { }
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册