Remove usage of old `ServiceHubServiceBase` ctor.

- The change wasn't exactly what was expected. The core `ServiceHub` is still what calls into our `Stream`, `IServiceProvider` overload (as intended) which means we needed to call down into the proper basetype constructor to start using Roslyn's non-obsolete one.
- Had to manually start the `StreamJsonRpc` property to work around race conditions in the ServiceHub APIs.

#976
This commit is contained in:
N. Taylor Mullen 2017-05-11 15:57:39 -07:00
parent b44d59ca36
commit 870b264039
1 changed files with 5 additions and 7 deletions

View File

@ -16,17 +16,15 @@ namespace Microsoft.CodeAnalysis.Remote.Razor
{
internal class RazorLanguageService : ServiceHubServiceBase
{
[Obsolete("This will be removed as part of #976. ServiceHub still calls this constructor. Remove once ServiceHub can use the other one.")]
public RazorLanguageService(Stream stream, IServiceProvider serviceProvider)
: base(stream, serviceProvider)
{
Rpc.JsonSerializer.Converters.Add(new RazorDiagnosticJsonConverter());
}
public RazorLanguageService(IServiceProvider serviceProvider, Stream stream)
: base(serviceProvider, stream)
{
Rpc.JsonSerializer.Converters.Add(new RazorDiagnosticJsonConverter());
// Due to this issue - https://github.com/dotnet/roslyn/issues/16900#issuecomment-277378950
// We need to manually start the RPC connection. Otherwise we'd be opting ourselves into
// race condition prone call paths.
Rpc.StartListening();
}
public async Task<TagHelperResolutionResult> GetTagHelpersAsync(Guid projectIdBytes, string projectDebugName, IEnumerable<string> assemblyNameFilters, CancellationToken cancellationToken = default(CancellationToken))