diff --git a/GeothermalResearchInstitute/GeothermalResearchInstitute.FakePlcV2/FakePlc.cs b/GeothermalResearchInstitute/GeothermalResearchInstitute.FakePlcV2/FakePlc.cs index 7b236d69..4e55877e 100644 --- a/GeothermalResearchInstitute/GeothermalResearchInstitute.FakePlcV2/FakePlc.cs +++ b/GeothermalResearchInstitute/GeothermalResearchInstitute.FakePlcV2/FakePlc.cs @@ -114,7 +114,7 @@ public async Task StopAsync() } this.cancellationTokenSource.Cancel(); - await this.backgroundTask.ConfigureAwait(true); + await this.backgroundTask.ConfigureAwait(false); this.client.Close(); this.backgroundTask.Dispose(); @@ -133,7 +133,7 @@ protected virtual void Dispose(bool disposing) { if (this.backgroundTask != null) { - this.StopAsync().ConfigureAwait(true).GetAwaiter().GetResult(); + this.StopAsync().GetAwaiter().GetResult(); } } diff --git a/GeothermalResearchInstitute/GeothermalResearchInstitute.PlcV2/PlcClient.cs b/GeothermalResearchInstitute/GeothermalResearchInstitute.PlcV2/PlcClient.cs index 34188a92..708e04ca 100644 --- a/GeothermalResearchInstitute/GeothermalResearchInstitute.PlcV2/PlcClient.cs +++ b/GeothermalResearchInstitute/GeothermalResearchInstitute.PlcV2/PlcClient.cs @@ -103,7 +103,7 @@ protected virtual void Dispose(bool disposing) { if (disposing) { - this.Close().ConfigureAwait(true).GetAwaiter().GetResult(); + this.Close().GetAwaiter().GetResult(); this.sendingBackgroundTask.Dispose(); this.receivingBackgroundTask.Dispose(); diff --git a/GeothermalResearchInstitute/GeothermalResearchInstitute.PlcV2/PlcServer.cs b/GeothermalResearchInstitute/GeothermalResearchInstitute.PlcV2/PlcServer.cs index 7a026e2a..733719b3 100644 --- a/GeothermalResearchInstitute/GeothermalResearchInstitute.PlcV2/PlcServer.cs +++ b/GeothermalResearchInstitute/GeothermalResearchInstitute.PlcV2/PlcServer.cs @@ -38,7 +38,7 @@ public async Task AcceptAsync() { TcpClient tcpClient = await this.tcpListener .AcceptTcpClientAsync() - .ConfigureAwait(true); + .ConfigureAwait(false); return new PlcClient(this.loggerFactory.CreateLogger(), tcpClient); } } diff --git a/GeothermalResearchInstitute/GeothermalResearchInstitute.ServerConsole/FakeDevicesHostedService.cs b/GeothermalResearchInstitute/GeothermalResearchInstitute.ServerConsole/FakeDevicesHostedService.cs index 02a4d4f3..c056a8b2 100644 --- a/GeothermalResearchInstitute/GeothermalResearchInstitute.ServerConsole/FakeDevicesHostedService.cs +++ b/GeothermalResearchInstitute/GeothermalResearchInstitute.ServerConsole/FakeDevicesHostedService.cs @@ -47,7 +47,7 @@ public async Task StopAsync(CancellationToken cancellationToken) { foreach (FakePlc plc in this.fakePlcList) { - await plc.StopAsync().ConfigureAwait(true); + await plc.StopAsync().ConfigureAwait(false); } } @@ -64,7 +64,7 @@ protected virtual void Dispose(bool disposing) { foreach (FakePlc plc in this.fakePlcList) { - plc.StopAsync().ConfigureAwait(true).GetAwaiter().GetResult(); + plc.StopAsync().ConfigureAwait(false).GetAwaiter().GetResult(); plc.Dispose(); } } diff --git a/GeothermalResearchInstitute/GeothermalResearchInstitute.ServerConsole/GrpcServices/DeviceServiceImpl.cs b/GeothermalResearchInstitute/GeothermalResearchInstitute.ServerConsole/GrpcServices/DeviceServiceImpl.cs index 1064c1a7..8c9b969b 100644 --- a/GeothermalResearchInstitute/GeothermalResearchInstitute.ServerConsole/GrpcServices/DeviceServiceImpl.cs +++ b/GeothermalResearchInstitute/GeothermalResearchInstitute.ServerConsole/GrpcServices/DeviceServiceImpl.cs @@ -468,7 +468,7 @@ private async void AskPersistDeviceAlarm(object state) new GetAlarmRequest(), DateTime.UtcNow.AddMilliseconds( coreOptions.Value.DefaultReadTimeoutMillis)) - .ConfigureAwait(true); + .ConfigureAwait(false); var m = new ModelAlarm { @@ -532,7 +532,7 @@ private async void AskPersistDeviceMetric(object state) new GetMetricRequest(), DateTime.UtcNow.AddMilliseconds( coreOptions.Value.DefaultReadTimeoutMillis)) - .ConfigureAwait(true); + .ConfigureAwait(false); var m = new ModelMetric { diff --git a/GeothermalResearchInstitute/GeothermalResearchInstitute.ServerConsole/PlcManager.cs b/GeothermalResearchInstitute/GeothermalResearchInstitute.ServerConsole/PlcManager.cs index 0843ebe2..5a4df582 100644 --- a/GeothermalResearchInstitute/GeothermalResearchInstitute.ServerConsole/PlcManager.cs +++ b/GeothermalResearchInstitute/GeothermalResearchInstitute.ServerConsole/PlcManager.cs @@ -61,13 +61,13 @@ public Task StartAsync(CancellationToken cancellationToken) public async Task StopAsync() { this.cancellationTokenSource.Cancel(); - await this.backgroundTask.ConfigureAwait(true); + await this.backgroundTask.ConfigureAwait(false); foreach (ByteString id in this.PlcDictionary.Keys) { if (this.PlcDictionary.TryRemove(id, out PlcClient client)) { - await client.Close().ConfigureAwait(true); + await client.Close().ConfigureAwait(false); client.Dispose(); } } @@ -87,7 +87,7 @@ private async void BackgroundTaskEntryPoint() PlcClient client = null; try { - client = await this.plcServer.AcceptAsync().ConfigureAwait(true); + client = await this.plcServer.AcceptAsync().ConfigureAwait(false); this.logger.LogInformation("TCP connection established from {0}", client.RemoteEndPoint); } catch (SocketException e) @@ -106,7 +106,11 @@ private async void BackgroundTaskEntryPoint() { response = await client .ConnectAsync(new ConnectRequest(), DateTime.UtcNow.AddSeconds(10)) - .ConfigureAwait(true); + .ConfigureAwait(false); + this.logger.LogInformation( + "ConnectResponse received from newly PLC {0}: {1}", + client.RemoteEndPoint, + response); } catch (RpcException e) { @@ -114,7 +118,7 @@ private async void BackgroundTaskEntryPoint() e, "Failed to send ConnectRequest to newly PLC {0}, hang up.", client.RemoteEndPoint); - await client.Close().ConfigureAwait(true); + await client.Close().ConfigureAwait(false); client.Dispose(); continue; } @@ -141,7 +145,7 @@ private async void BackgroundTaskEntryPoint() "Failed to add the client(MAC={0}, EndPoint={1}) into dictionary.", BitConverter.ToString(response.Id.ToByteArray()), client.RemoteEndPoint); - await client.Close().ConfigureAwait(true); + await client.Close().ConfigureAwait(false); client.Dispose(); } } diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 773147bb..3e9a4d1c 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -33,5 +33,5 @@ steps: publishDirectory: '$(Build.ArtifactStagingDirectory)' feedsToUsePublish: 'internal' vstsFeedPublish: '6fdda69a-feef-492b-9027-6ca329dcade4/af8d15e0-742a-4658-a87e-06eb29c6e60e' - vstsFeedPackagePublish: 'OneDotNet' + vstsFeedPackagePublish: 'one-dotnet' versionOption: 'patch'