Skip to content

Commit 9f9307f

Browse files
committed
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 <[email protected]>
1 parent b6da27a commit 9f9307f

File tree

6 files changed

+34
-67
lines changed

6 files changed

+34
-67
lines changed

Example Projects/dotNetCoreExample/dotNetCoreExample.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>netcoreapp2.0</TargetFramework>
5+
<TargetFramework>net6.0</TargetFramework>
66
</PropertyGroup>
77

88
<ItemGroup>

azure-pipelines.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

src/SocketLabs/InjectionApi/SocketLabsClient.cs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -326,11 +326,8 @@ public SendResponse Send(IBasicMessage message)
326326
{
327327
var source = new CancellationTokenSource();
328328
//Read this if you have questions: https://blogs.msdn.microsoft.com/pfxteam/2012/04/13/should-i-expose-synchronous-wrappers-for-asynchronous-methods/
329-
var sendTask = Task.Run(() => SendAsync(message, source.Token));
330-
331-
while (!sendTask.IsCompleted) { }
332-
if (sendTask.Status == TaskStatus.Faulted) throw sendTask.Exception;
333-
329+
var sendTask = Task.Run(() => SendAsync(message, source.Token), source.Token);
330+
334331
return sendTask.Result;
335332

336333
}
@@ -381,10 +378,7 @@ public SendResponse Send(IBulkMessage message)
381378
var source = new CancellationTokenSource();
382379

383380
//Read this if you have questions: https://blogs.msdn.microsoft.com/pfxteam/2012/04/13/should-i-expose-synchronous-wrappers-for-asynchronous-methods/
384-
var sendTask = Task.Run(() => SendAsync(message, source.Token));
385-
386-
while (!sendTask.IsCompleted) { }
387-
if (sendTask.Status == TaskStatus.Faulted) throw sendTask.Exception;
381+
var sendTask = Task.Run(() => SendAsync(message, source.Token), source.Token);
388382

389383
return sendTask.Result;
390384
}

src/SocketLabs/SocketLabs.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netstandard1.3;netstandard2.0;net45;net5.0</TargetFrameworks>
4+
<TargetFrameworks>netstandard2.0;net48;net5.0;net6.0</TargetFrameworks>
55
<PlatformTarget>anycpu</PlatformTarget>
66
<GenerateDocumentationFile>true</GenerateDocumentationFile>
77
<AssemblyName>SocketLabs</AssemblyName>
88
<PackageId>SocketLabs</PackageId>
99
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
1010
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
1111
<Version>1.2.3</Version>
12-
<Copyright>(C) 2018-2021 SocketLabs</Copyright>
12+
<Copyright>(C) 2018-2022 SocketLabs</Copyright>
1313
<PackageIconUrl>https://www.socketlabs.com/assets/socketlabs-logo1.png</PackageIconUrl>
1414
<Authors>SocketLabs Development Team</Authors>
1515
<Product>SocketLabs .Net Client Library</Product>
@@ -56,8 +56,8 @@
5656
</ItemGroup>
5757

5858
<ItemGroup>
59-
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
60-
<PackageReference Include="System.Net.Http" Version="4.3.3" />
59+
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
60+
<PackageReference Include="System.Net.Http" Version="4.3.4" />
6161
</ItemGroup>
6262

6363
<Target Name="TeamCity" AfterTargets="Build" Condition=" '$(TeamCityBuild)'=='true' AND '$(TargetFileName)' != ''">

test/SocketLabs.Test/SocketLabs.UnitTests.csproj

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<Import Project="..\..\packages\MSTest.TestAdapter.1.2.1\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\..\packages\MSTest.TestAdapter.1.2.1\build\net45\MSTest.TestAdapter.props')" />
3+
<Import Project="..\..\packages\MSTest.TestAdapter.2.2.8\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\..\packages\MSTest.TestAdapter.2.2.8\build\net45\MSTest.TestAdapter.props')" />
44
<PropertyGroup>
55
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
66
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -9,7 +9,7 @@
99
<AppDesignerFolder>Properties</AppDesignerFolder>
1010
<RootNamespace>SocketLabs.Test</RootNamespace>
1111
<AssemblyName>SocketLabs.Test</AssemblyName>
12-
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
12+
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
1313
<FileAlignment>512</FileAlignment>
1414
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
1515
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
@@ -19,6 +19,7 @@
1919
<TestProjectType>UnitTest</TestProjectType>
2020
<NuGetPackageImportStamp>
2121
</NuGetPackageImportStamp>
22+
<TargetFrameworkProfile />
2223
</PropertyGroup>
2324
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
2425
<DebugSymbols>true</DebugSymbols>
@@ -43,25 +44,28 @@
4344
</PropertyGroup>
4445
<ItemGroup>
4546
<Reference Include="Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
46-
<HintPath>..\..\packages\Castle.Core.4.3.1\lib\net45\Castle.Core.dll</HintPath>
47+
<HintPath>..\..\packages\Castle.Core.4.4.1\lib\net45\Castle.Core.dll</HintPath>
4748
</Reference>
4849
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
49-
<HintPath>..\..\packages\MSTest.TestFramework.1.2.1\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
50+
<HintPath>..\..\packages\MSTest.TestFramework.2.2.8\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
5051
</Reference>
5152
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
52-
<HintPath>..\..\packages\MSTest.TestFramework.1.2.1\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
53+
<HintPath>..\..\packages\MSTest.TestFramework.2.2.8\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
5354
</Reference>
54-
<Reference Include="Moq, Version=4.10.0.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
55-
<HintPath>..\..\packages\Moq.4.10.0\lib\net45\Moq.dll</HintPath>
55+
<Reference Include="Moq, Version=4.16.0.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
56+
<HintPath>..\..\packages\Moq.4.16.1\lib\net45\Moq.dll</HintPath>
5657
</Reference>
5758
<Reference Include="System" />
5859
<Reference Include="System.Configuration" />
5960
<Reference Include="System.Core" />
60-
<Reference Include="System.Threading.Tasks.Extensions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
61-
<HintPath>..\..\packages\System.Threading.Tasks.Extensions.4.3.0\lib\portable-net45+win8+wp8+wpa81\System.Threading.Tasks.Extensions.dll</HintPath>
61+
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
62+
<HintPath>..\..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
6263
</Reference>
63-
<Reference Include="System.ValueTuple, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
64-
<HintPath>..\..\packages\System.ValueTuple.4.4.0\lib\net461\System.ValueTuple.dll</HintPath>
64+
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
65+
<HintPath>..\..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
66+
</Reference>
67+
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
68+
<HintPath>..\..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
6569
</Reference>
6670
</ItemGroup>
6771
<ItemGroup>
@@ -73,6 +77,7 @@
7377
<None Include="..\..\.editorconfig">
7478
<Link>.editorconfig</Link>
7579
</None>
80+
<None Include="app.config" />
7681
<None Include="packages.config" />
7782
</ItemGroup>
7883
<ItemGroup>
@@ -88,8 +93,8 @@
8893
<PropertyGroup>
8994
<ErrorText>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}.</ErrorText>
9095
</PropertyGroup>
91-
<Error Condition="!Exists('..\..\packages\MSTest.TestAdapter.1.2.1\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\MSTest.TestAdapter.1.2.1\build\net45\MSTest.TestAdapter.props'))" />
92-
<Error Condition="!Exists('..\..\packages\MSTest.TestAdapter.1.2.1\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\MSTest.TestAdapter.1.2.1\build\net45\MSTest.TestAdapter.targets'))" />
96+
<Error Condition="!Exists('..\..\packages\MSTest.TestAdapter.2.2.8\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\MSTest.TestAdapter.2.2.8\build\net45\MSTest.TestAdapter.props'))" />
97+
<Error Condition="!Exists('..\..\packages\MSTest.TestAdapter.2.2.8\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\MSTest.TestAdapter.2.2.8\build\net45\MSTest.TestAdapter.targets'))" />
9398
</Target>
94-
<Import Project="..\..\packages\MSTest.TestAdapter.1.2.1\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\..\packages\MSTest.TestAdapter.1.2.1\build\net45\MSTest.TestAdapter.targets')" />
99+
<Import Project="..\..\packages\MSTest.TestAdapter.2.2.8\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\..\packages\MSTest.TestAdapter.2.2.8\build\net45\MSTest.TestAdapter.targets')" />
95100
</Project>

test/SocketLabs.Test/packages.config

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="Castle.Core" version="4.3.1" targetFramework="net461" />
4-
<package id="Moq" version="4.10.0" targetFramework="net461" />
5-
<package id="MSTest.TestAdapter" version="1.2.1" targetFramework="net461" />
6-
<package id="MSTest.TestFramework" version="1.2.1" targetFramework="net461" />
7-
<package id="System.Threading.Tasks.Extensions" version="4.3.0" targetFramework="net461" />
8-
<package id="System.ValueTuple" version="4.4.0" targetFramework="net461" />
3+
<package id="Castle.Core" version="4.4.1" targetFramework="net48" />
4+
<package id="Moq" version="4.16.1" targetFramework="net48" />
5+
<package id="MSTest.TestAdapter" version="2.2.8" targetFramework="net48" />
6+
<package id="MSTest.TestFramework" version="2.2.8" targetFramework="net48" />
7+
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net48" />
8+
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net48" />
9+
<package id="System.ValueTuple" version="4.5.0" targetFramework="net48" />
910
</packages>

0 commit comments

Comments
 (0)