diff --git a/src/Microsoft.SqlTools.Hosting/Hosting/IHostedService.cs b/src/Microsoft.SqlTools.Hosting/Hosting/IHostedService.cs index 61b73715..44e5030a 100644 --- a/src/Microsoft.SqlTools.Hosting/Hosting/IHostedService.cs +++ b/src/Microsoft.SqlTools.Hosting/Hosting/IHostedService.cs @@ -67,13 +67,13 @@ namespace Microsoft.SqlTools.Hosting } } - protected async Task HandleRequestAsync(Func> handler, RequestContext requestContext, string requestType) + protected async Task HandleRequestAsync(Func> handler, RequestContext requestContext, string requestType) { Logger.Write(LogLevel.Verbose, requestType); try { - T result = await handler(); + THandler result = await handler(); await requestContext.SendResult(result); return result; } @@ -81,7 +81,7 @@ namespace Microsoft.SqlTools.Hosting { await requestContext.SendError(ex.ToString()); } - return default(T); + return default(THandler); } public abstract void InitializeService(IProtocolEndpoint serviceHost); diff --git a/src/Microsoft.SqlTools.Hosting/Hosting/ServiceHostBase.cs b/src/Microsoft.SqlTools.Hosting/Hosting/ServiceHostBase.cs index 38fe2290..d17bb6e0 100644 --- a/src/Microsoft.SqlTools.Hosting/Hosting/ServiceHostBase.cs +++ b/src/Microsoft.SqlTools.Hosting/Hosting/ServiceHostBase.cs @@ -12,7 +12,6 @@ namespace Microsoft.SqlTools.Hosting { public abstract class ServiceHostBase : ProtocolEndpoint { - private bool isStarted; private TaskCompletionSource serverExitedTask; protected ServiceHostBase(ChannelBase serverChannel) : @@ -25,6 +24,7 @@ namespace Microsoft.SqlTools.Hosting // Register handlers for server lifetime messages this.SetEventHandler(ExitNotification.Type, this.HandleExitNotification); + this.serverExitedTask = new TaskCompletionSource(); return Task.FromResult(true); } diff --git a/src/Microsoft.SqlTools.ServiceLayer/Admin/Common/ICloneable.cs b/src/Microsoft.SqlTools.ServiceLayer/Admin/Common/ICloneable.cs deleted file mode 100644 index 7431ff68..00000000 --- a/src/Microsoft.SqlTools.ServiceLayer/Admin/Common/ICloneable.cs +++ /dev/null @@ -1,12 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -// - -namespace System -{ - internal interface ICloneable - { - object Clone(); - } -} \ No newline at end of file diff --git a/src/Microsoft.SqlTools.ServiceLayer/QueryExecution/ResultOnlyContext.cs b/src/Microsoft.SqlTools.ServiceLayer/QueryExecution/ResultOnlyContext.cs index 93c43883..27d233a5 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/QueryExecution/ResultOnlyContext.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/QueryExecution/ResultOnlyContext.cs @@ -21,10 +21,11 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution origContext = context; } - public virtual async Task SendEvent(EventType eventType, TParams eventParams) + public virtual Task SendEvent(EventType eventType, TParams eventParams) { // no op to swallow events // in the future this could be used to roll up events and send them back in the result + return Task.FromResult(true); } } } \ No newline at end of file diff --git a/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/Connection/ReliableConnectionTests.cs b/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/Connection/ReliableConnectionTests.cs index 6396bfbb..154d9323 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/Connection/ReliableConnectionTests.cs +++ b/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/Connection/ReliableConnectionTests.cs @@ -933,8 +933,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.Connection [Fact] public void StatementCompletedTests() { - bool handlerCalled = false; - StatementCompletedEventHandler handler = (s, e) => handlerCalled = true; + StatementCompletedEventHandler handler = (s, e) => { }; var command = new DbCommandWrapper(new SqlCommand()); command.StatementCompleted += handler; command.StatementCompleted -= handler;