Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
524b6095
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,发现更多精彩内容 >>
提交
524b6095
编写于
2月 03, 2017
作者:
H
Heejae Chang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
made all services to explicitly call JsonRpc.StartListening. otherwise, we can get into a race.
上级
0ed38ad1
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
52 addition
and
9 deletion
+52
-9
src/EditorFeatures/TestUtilities/Remote/InProcRemostHostClient.cs
...orFeatures/TestUtilities/Remote/InProcRemostHostClient.cs
+4
-2
src/VisualStudio/Core/Next/Remote/JsonRpcClient.cs
src/VisualStudio/Core/Next/Remote/JsonRpcClient.cs
+9
-1
src/VisualStudio/Core/Next/Remote/JsonRpcSession.cs
src/VisualStudio/Core/Next/Remote/JsonRpcSession.cs
+4
-0
src/VisualStudio/Core/Next/Remote/ServiceHubRemoteHostClient.cs
...sualStudio/Core/Next/Remote/ServiceHubRemoteHostClient.cs
+4
-2
src/Workspaces/Remote/ServiceHub/Services/CodeAnalysisService.cs
...kspaces/Remote/ServiceHub/Services/CodeAnalysisService.cs
+2
-1
src/Workspaces/Remote/ServiceHub/Services/RemoteHostService.cs
...orkspaces/Remote/ServiceHub/Services/RemoteHostService.cs
+2
-1
src/Workspaces/Remote/ServiceHub/Services/RemoteSymbolSearchUpdateEngine.cs
...ote/ServiceHub/Services/RemoteSymbolSearchUpdateEngine.cs
+3
-1
src/Workspaces/Remote/ServiceHub/Services/SnapshotService.cs
src/Workspaces/Remote/ServiceHub/Services/SnapshotService.cs
+3
-1
src/Workspaces/Remote/ServiceHub/Shared/ServiceHubServiceBase.cs
...kspaces/Remote/ServiceHub/Shared/ServiceHubServiceBase.cs
+21
-0
未找到文件。
src/EditorFeatures/TestUtilities/Remote/InProcRemostHostClient.cs
浏览文件 @
524b6095
...
...
@@ -16,7 +16,7 @@
namespace
Roslyn.Test.Utilities.Remote
{
internal
class
InProcRemoteHostClient
:
RemoteHostClient
internal
sealed
class
InProcRemoteHostClient
:
RemoteHostClient
{
private
readonly
InProcRemoteServices
_inprocServices
;
private
readonly
JsonRpc
_rpc
;
...
...
@@ -47,10 +47,12 @@ public static async Task<RemoteHostClient> CreateAsync(Workspace workspace, bool
{
_inprocServices
=
inprocServices
;
_rpc
=
JsonRpc
.
Attach
(
stream
,
target
:
this
);
_rpc
=
new
JsonRpc
(
stream
,
stream
,
target
:
this
);
// handle disconnected situation
_rpc
.
Disconnected
+=
OnRpcDisconnected
;
_rpc
.
StartListening
();
}
public
AssetStorage
AssetStorage
=>
_inprocServices
.
AssetStorage
;
...
...
src/VisualStudio/Core/Next/Remote/JsonRpcClient.cs
浏览文件 @
524b6095
...
...
@@ -25,7 +25,8 @@ internal class JsonRpcClient : IDisposable
var
target
=
useThisAsCallback
?
this
:
callbackTarget
;
_cancellationToken
=
cancellationToken
;
_rpc
=
JsonRpc
.
Attach
(
stream
,
target
);
_rpc
=
new
JsonRpc
(
stream
,
stream
,
target
);
_rpc
.
Disconnected
+=
OnDisconnected
;
}
...
...
@@ -84,6 +85,13 @@ public void Dispose()
_rpc
.
Dispose
();
}
protected
void
StartListening
()
{
// due to this issue - https://github.com/dotnet/roslyn/issues/16900#issuecomment-277378950
// _rpc need to be explicitly started
_rpc
.
StartListening
();
}
protected
virtual
void
OnDisposed
()
{
// do nothing
...
...
src/VisualStudio/Core/Next/Remote/JsonRpcSession.cs
浏览文件 @
524b6095
...
...
@@ -114,6 +114,8 @@ public ServiceJsonRpcClient(Stream stream, object callbackTarget, CancellationTo
{
// this one doesn't need cancellation token since it has nothing to cancel
_callbackTarget
=
callbackTarget
;
StartListening
();
}
}
...
...
@@ -137,6 +139,8 @@ public SnapshotJsonRpcClient(JsonRpcSession owner, Stream stream, CancellationTo
{
_owner
=
owner
;
_source
=
new
CancellationTokenSource
();
StartListening
();
}
private
PinnedRemotableDataScope
PinnedScope
=>
_owner
.
PinnedScope
;
...
...
src/VisualStudio/Core/Next/Remote/ServiceHubRemoteHostClient.cs
浏览文件 @
524b6095
...
...
@@ -18,7 +18,7 @@ namespace Microsoft.VisualStudio.LanguageServices.Remote
using
Microsoft.CodeAnalysis.Editor.Shared.Utilities
;
using
Workspace
=
Microsoft
.
CodeAnalysis
.
Workspace
;
internal
partial
class
ServiceHubRemoteHostClient
:
RemoteHostClient
internal
sealed
partial
class
ServiceHubRemoteHostClient
:
RemoteHostClient
{
private
readonly
HubClient
_hubClient
;
private
readonly
JsonRpc
_rpc
;
...
...
@@ -81,10 +81,12 @@ private static async Task RegisterWorkspaceHostAsync(Workspace workspace, Remote
_hubClient
=
hubClient
;
_hostGroup
=
hostGroup
;
_rpc
=
JsonRpc
.
Attach
(
stream
,
target
:
this
);
_rpc
=
new
JsonRpc
(
stream
,
stream
,
target
:
this
);
// handle disconnected situation
_rpc
.
Disconnected
+=
OnRpcDisconnected
;
_rpc
.
StartListening
();
}
protected
override
async
Task
<
Session
>
CreateServiceSessionAsync
(
string
serviceName
,
PinnedRemotableDataScope
snapshot
,
object
callbackTarget
,
CancellationToken
cancellationToken
)
...
...
src/Workspaces/Remote/ServiceHub/Services/CodeAnalysisService.cs
浏览文件 @
524b6095
...
...
@@ -9,8 +9,9 @@ namespace Microsoft.CodeAnalysis.Remote
internal
partial
class
CodeAnalysisService
:
ServiceHubServiceBase
{
public
CodeAnalysisService
(
Stream
stream
,
IServiceProvider
serviceProvider
)
:
base
(
s
tream
,
serviceProvider
)
base
(
s
erviceProvider
,
stream
)
{
Rpc
.
StartListening
();
}
}
}
src/Workspaces/Remote/ServiceHub/Services/RemoteHostService.cs
浏览文件 @
524b6095
...
...
@@ -39,9 +39,10 @@ static RemoteHostService()
}
public
RemoteHostService
(
Stream
stream
,
IServiceProvider
serviceProvider
)
:
base
(
s
tream
,
serviceProvider
)
base
(
s
erviceProvider
,
stream
)
{
// this service provide a way for client to make sure remote host is alive
Rpc
.
StartListening
();
}
public
string
Connect
(
string
host
)
...
...
src/Workspaces/Remote/ServiceHub/Services/RemoteSymbolSearchUpdateEngine.cs
浏览文件 @
524b6095
...
...
@@ -13,10 +13,12 @@ internal partial class RemoteSymbolSearchUpdateEngine : ServiceHubServiceBase, I
private
readonly
SymbolSearchUpdateEngine
_updateEngine
;
public
RemoteSymbolSearchUpdateEngine
(
Stream
stream
,
IServiceProvider
serviceProvider
)
:
base
(
s
tream
,
serviceProvider
)
:
base
(
s
erviceProvider
,
stream
)
{
_updateEngine
=
new
SymbolSearchUpdateEngine
(
new
LogService
(
this
),
updateCancellationToken
:
this
.
CancellationToken
);
Rpc
.
StartListening
();
}
public
Task
UpdateContinuouslyAsync
(
string
sourceName
,
string
localSettingsDirectory
)
...
...
src/Workspaces/Remote/ServiceHub/Services/SnapshotService.cs
浏览文件 @
524b6095
...
...
@@ -20,9 +20,11 @@ internal partial class SnapshotService : ServiceHubServiceBase
private
AssetSource
_source
;
public
SnapshotService
(
Stream
stream
,
IServiceProvider
serviceProvider
)
:
base
(
s
tream
,
serviceProvider
)
base
(
s
erviceProvider
,
stream
)
{
_gate
=
new
object
();
Rpc
.
StartListening
();
}
public
override
void
Initialize
(
int
sessionId
,
byte
[]
solutionChecksum
)
...
...
src/Workspaces/Remote/ServiceHub/Shared/ServiceHubServiceBase.cs
浏览文件 @
524b6095
...
...
@@ -29,6 +29,7 @@ internal abstract class ServiceHubServiceBase : IDisposable
private
Checksum
_solutionChecksumOpt
;
private
RoslynServices
_lazyRoslynServices
;
[
Obsolete
(
"For backward compatibility. this will be removed once all callers moved to new ctor"
)]
protected
ServiceHubServiceBase
(
Stream
stream
,
IServiceProvider
serviceProvider
)
{
_instanceId
=
Interlocked
.
Add
(
ref
s_instanceId
,
1
);
...
...
@@ -46,6 +47,26 @@ protected ServiceHubServiceBase(Stream stream, IServiceProvider serviceProvider)
Rpc
.
Disconnected
+=
OnRpcDisconnected
;
}
protected
ServiceHubServiceBase
(
IServiceProvider
serviceProvider
,
Stream
stream
)
{
_instanceId
=
Interlocked
.
Add
(
ref
s_instanceId
,
1
);
// in unit test, service provider will return asset storage, otherwise, use the default one
AssetStorage
=
(
AssetStorage
)
serviceProvider
.
GetService
(
typeof
(
AssetStorage
))
??
AssetStorage
.
Default
;
Logger
=
(
TraceSource
)
serviceProvider
.
GetService
(
typeof
(
TraceSource
));
Logger
.
TraceInformation
(
$"
{
DebugInstanceString
}
Service instance created"
);
_cancellationTokenSource
=
new
CancellationTokenSource
();
CancellationToken
=
_cancellationTokenSource
.
Token
;
// due to this issue - https://github.com/dotnet/roslyn/issues/16900#issuecomment-277378950
// all sub type must explicitly start JsonRpc once everything is
// setup
Rpc
=
new
JsonRpc
(
stream
,
stream
,
this
);
Rpc
.
Disconnected
+=
OnRpcDisconnected
;
}
protected
string
DebugInstanceString
=>
$"
{
GetType
()}
(
{
_instanceId
}
)"
;
protected
RoslynServices
RoslynServices
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录