From 358a0ebce1cdb339f702a9e9853292e44b4c45b8 Mon Sep 17 00:00:00 2001 From: Bill Volz Date: Wed, 4 Dec 2019 13:53:55 -0500 Subject: [PATCH 1/2] Set up CI with Azure Pipelines [skip ci] --- azure-pipelines.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 azure-pipelines.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000..6a9684e --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,33 @@ +# .NET Desktop +# Build and run tests for .NET Desktop or Windows classic desktop solutions. +# Add steps that publish symbols, save build artifacts, and more: +# https://docs.microsoft.com/azure/devops/pipelines/apps/windows/dot-net + +trigger: +- master + +pool: + vmImage: 'windows-latest' + +variables: + solution: '**/*.sln' + buildPlatform: 'Any CPU' + buildConfiguration: 'Release' + +steps: +- task: NuGetToolInstaller@1 + +- task: NuGetCommand@2 + inputs: + restoreSolution: '$(solution)' + +- task: VSBuild@1 + inputs: + solution: '$(solution)' + platform: '$(buildPlatform)' + configuration: '$(buildConfiguration)' + +- task: VSTest@2 + inputs: + platform: '$(buildPlatform)' + configuration: '$(buildConfiguration)' From 9f9307f4a01b1cecb8d3db6dec4fa2fa29568d21 Mon Sep 17 00:00:00 2001 From: Bill Volz Date: Tue, 18 Jan 2022 11:36:50 -0500 Subject: [PATCH 2/2] Removed unneeded wait loop from non async Send methods Update dotNetCoreExample project to use .Net 6.0 Added build targets for .Net 4.8 and 6.0 Removed build targets .Net 4.5 netstandard 1.3 Updated copyright information. Updated dependencies. Signed-off-by: Bill Volz --- .../dotNetCoreExample.csproj | 2 +- azure-pipelines.yml | 33 ------------------- .../InjectionApi/SocketLabsClient.cs | 12 ++----- src/SocketLabs/SocketLabs.csproj | 8 ++--- .../SocketLabs.UnitTests.csproj | 33 +++++++++++-------- test/SocketLabs.Test/packages.config | 13 ++++---- 6 files changed, 34 insertions(+), 67 deletions(-) delete mode 100644 azure-pipelines.yml diff --git a/Example Projects/dotNetCoreExample/dotNetCoreExample.csproj b/Example Projects/dotNetCoreExample/dotNetCoreExample.csproj index d15bbbb..a93cbff 100644 --- a/Example Projects/dotNetCoreExample/dotNetCoreExample.csproj +++ b/Example Projects/dotNetCoreExample/dotNetCoreExample.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp2.0 + net6.0 diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index 6a9684e..0000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,33 +0,0 @@ -# .NET Desktop -# Build and run tests for .NET Desktop or Windows classic desktop solutions. -# Add steps that publish symbols, save build artifacts, and more: -# https://docs.microsoft.com/azure/devops/pipelines/apps/windows/dot-net - -trigger: -- master - -pool: - vmImage: 'windows-latest' - -variables: - solution: '**/*.sln' - buildPlatform: 'Any CPU' - buildConfiguration: 'Release' - -steps: -- task: NuGetToolInstaller@1 - -- task: NuGetCommand@2 - inputs: - restoreSolution: '$(solution)' - -- task: VSBuild@1 - inputs: - solution: '$(solution)' - platform: '$(buildPlatform)' - configuration: '$(buildConfiguration)' - -- task: VSTest@2 - inputs: - platform: '$(buildPlatform)' - configuration: '$(buildConfiguration)' diff --git a/src/SocketLabs/InjectionApi/SocketLabsClient.cs b/src/SocketLabs/InjectionApi/SocketLabsClient.cs index 562e775..b3cda97 100644 --- a/src/SocketLabs/InjectionApi/SocketLabsClient.cs +++ b/src/SocketLabs/InjectionApi/SocketLabsClient.cs @@ -326,11 +326,8 @@ public SendResponse Send(IBasicMessage message) { var source = new CancellationTokenSource(); //Read this if you have questions: https://blogs.msdn.microsoft.com/pfxteam/2012/04/13/should-i-expose-synchronous-wrappers-for-asynchronous-methods/ - var sendTask = Task.Run(() => SendAsync(message, source.Token)); - - while (!sendTask.IsCompleted) { } - if (sendTask.Status == TaskStatus.Faulted) throw sendTask.Exception; - + var sendTask = Task.Run(() => SendAsync(message, source.Token), source.Token); + return sendTask.Result; } @@ -381,10 +378,7 @@ public SendResponse Send(IBulkMessage message) var source = new CancellationTokenSource(); //Read this if you have questions: https://blogs.msdn.microsoft.com/pfxteam/2012/04/13/should-i-expose-synchronous-wrappers-for-asynchronous-methods/ - var sendTask = Task.Run(() => SendAsync(message, source.Token)); - - while (!sendTask.IsCompleted) { } - if (sendTask.Status == TaskStatus.Faulted) throw sendTask.Exception; + var sendTask = Task.Run(() => SendAsync(message, source.Token), source.Token); return sendTask.Result; } diff --git a/src/SocketLabs/SocketLabs.csproj b/src/SocketLabs/SocketLabs.csproj index d2e43d1..a5dd9ab 100644 --- a/src/SocketLabs/SocketLabs.csproj +++ b/src/SocketLabs/SocketLabs.csproj @@ -1,7 +1,7 @@  - netstandard1.3;netstandard2.0;net45;net5.0 + netstandard2.0;net48;net5.0;net6.0 anycpu true SocketLabs @@ -9,7 +9,7 @@ false false 1.2.3 - (C) 2018-2021 SocketLabs + (C) 2018-2022 SocketLabs https://www.socketlabs.com/assets/socketlabs-logo1.png SocketLabs Development Team SocketLabs .Net Client Library @@ -56,8 +56,8 @@ - - + + diff --git a/test/SocketLabs.Test/SocketLabs.UnitTests.csproj b/test/SocketLabs.Test/SocketLabs.UnitTests.csproj index 81ee08c..461bffa 100644 --- a/test/SocketLabs.Test/SocketLabs.UnitTests.csproj +++ b/test/SocketLabs.Test/SocketLabs.UnitTests.csproj @@ -1,6 +1,6 @@  - + Debug AnyCPU @@ -9,7 +9,7 @@ Properties SocketLabs.Test SocketLabs.Test - v4.6.1 + v4.8 512 {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 15.0 @@ -19,6 +19,7 @@ UnitTest + true @@ -43,25 +44,28 @@ - ..\..\packages\Castle.Core.4.3.1\lib\net45\Castle.Core.dll + ..\..\packages\Castle.Core.4.4.1\lib\net45\Castle.Core.dll - ..\..\packages\MSTest.TestFramework.1.2.1\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll + ..\..\packages\MSTest.TestFramework.2.2.8\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll - ..\..\packages\MSTest.TestFramework.1.2.1\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll + ..\..\packages\MSTest.TestFramework.2.2.8\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll - - ..\..\packages\Moq.4.10.0\lib\net45\Moq.dll + + ..\..\packages\Moq.4.16.1\lib\net45\Moq.dll - - ..\..\packages\System.Threading.Tasks.Extensions.4.3.0\lib\portable-net45+win8+wp8+wpa81\System.Threading.Tasks.Extensions.dll + + ..\..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll - - ..\..\packages\System.ValueTuple.4.4.0\lib\net461\System.ValueTuple.dll + + ..\..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll + + + ..\..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll @@ -73,6 +77,7 @@ .editorconfig + @@ -88,8 +93,8 @@ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + - + \ No newline at end of file diff --git a/test/SocketLabs.Test/packages.config b/test/SocketLabs.Test/packages.config index 095997c..173b49a 100644 --- a/test/SocketLabs.Test/packages.config +++ b/test/SocketLabs.Test/packages.config @@ -1,9 +1,10 @@  - - - - - - + + + + + + + \ No newline at end of file