Skip to content

Commit ec3134e

Browse files
authored
Merge pull request #102 from csrakowski/Updated_TargetFrameworks
Updated target frameworks
2 parents 42fc9a1 + 4720248 commit ec3134e

18 files changed

Lines changed: 90 additions & 143 deletions

.github/workflows/dotnetcore.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,20 @@ jobs:
1515
steps:
1616

1717
- name: Check out code onto host
18-
uses: actions/checkout@v4
18+
uses: actions/checkout@v6
1919

2020
- name: Setup .Net 6.0
21-
uses: actions/setup-dotnet@v4
21+
uses: actions/setup-dotnet@v5
2222
with:
2323
dotnet-version: '6.0.x' # SDK Version to use.
2424

2525
- name: Setup .Net 8.0
26-
uses: actions/setup-dotnet@v4
26+
uses: actions/setup-dotnet@v5
2727
with:
2828
dotnet-version: '8.0.x' # SDK Version to use.
2929

3030
- name: Setup .Net 9.0
31-
uses: actions/setup-dotnet@v4
31+
uses: actions/setup-dotnet@v5
3232
with:
3333
dotnet-version: '9.0.x' # SDK Version to use.
3434

@@ -58,15 +58,15 @@ jobs:
5858
if: matrix.framework == 'net80'
5959

6060
- name: Upload dotnet test results
61-
uses: actions/upload-artifact@v4
61+
uses: actions/upload-artifact@v5
6262
with:
6363
name: dotnet-results-${{ matrix.os }}-${{ matrix.framework }}
6464
path: TestResults-${{ matrix.os }}-${{ matrix.framework }}
6565
# Use always() to always run this step to publish test results when there are test failures
6666
if: ${{ always() }}
6767

6868
- name: Upload BenchmarkDotNet results
69-
uses: actions/upload-artifact@v4
69+
uses: actions/upload-artifact@v5
7070
with:
7171
name: BenchmarkDotNet-${{ matrix.os }}-${{ matrix.framework }}
7272
path: BenchmarkDotNet.Artifacts
@@ -84,13 +84,13 @@ jobs:
8484
steps:
8585

8686
- name: Check out code onto host
87-
uses: actions/checkout@v4
87+
uses: actions/checkout@v6
8888

8989
- name: Add msbuild to PATH
90-
uses: microsoft/setup-msbuild@v1.3.1
90+
uses: microsoft/setup-msbuild@v2
9191

9292
- name: Setup .Net 8.0
93-
uses: actions/setup-dotnet@v4
93+
uses: actions/setup-dotnet@v5
9494
with:
9595
dotnet-version: '8.0.x' # SDK Version to use.
9696

@@ -114,7 +114,7 @@ jobs:
114114
dotnet test --no-restore --configuration Release --verbosity normal --framework=${{ matrix.framework }} --logger trx --results-directory "TestResults-${{ matrix.os }}-${{ matrix.framework }}"
115115
116116
- name: Upload dotnet test results
117-
uses: actions/upload-artifact@v4
117+
uses: actions/upload-artifact@v5
118118
with:
119119
name: dotnet-results-windows-latest-${{ matrix.framework }}
120120
path: TestResults-windows-latest-${{ matrix.framework }}

src/CSRakowski.Parallel/CSRakowski.Parallel.csproj

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

33
<PropertyGroup>
4-
<TargetFrameworks>net472;net80;net60;netstandard2.1;netstandard2.0;netstandard1.1</TargetFrameworks>
4+
<TargetFrameworks>net80;net472;netstandard2.0</TargetFrameworks>
55
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
66
<Company />
77
<PackageId>CSRakowski.ParallelAsync</PackageId>
@@ -26,11 +26,7 @@
2626
</PropertyGroup>
2727

2828
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'net472'">
29-
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="6.0.0" />
30-
</ItemGroup>
31-
32-
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard1.1'">
33-
<PackageReference Include="CSRakowski.AsyncStreamsPreparations" Version="1.6.0" />
29+
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="[6.0.0,)" />
3430
</ItemGroup>
3531

3632
<ItemGroup>

src/CSRakowski.Parallel/Extensions/ParallelAsyncEx.AsyncStreams.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88

99
namespace CSRakowski.Parallel.Extensions
1010
{
11-
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_0_OR_GREATER
12-
1311
/// <summary>
1412
/// Extension methods to allow using the functionalities of <see cref="ParallelAsync"/> with a fluent syntax
1513
/// </summary>
@@ -28,7 +26,7 @@ public static partial class ParallelAsyncEx
2826
/// <returns>The results of the operations</returns>
2927
/// <exception cref="ArgumentNullException">Thrown when either <paramref name="parallelAsync"/> or <paramref name="func"/> is <c>null</c>.</exception>
3028
/// <exception cref="ArgumentOutOfRangeException">Thrown when the configured maximum batch size is a negative number.</exception>
31-
public static IAsyncEnumerable<TResult> ForEachAsyncStream<TInput, TResult>(this IParallelAsyncEnumerable<TInput> parallelAsync, Func<TInput, Task<TResult>> func, [EnumeratorCancellation] CancellationToken cancellationToken = default)
29+
public static IAsyncEnumerable<TResult> ForEachAsyncStream<TInput, TResult>(this IParallelAsyncEnumerable<TInput> parallelAsync, Func<TInput, Task<TResult>> func, CancellationToken cancellationToken = default)
3230
{
3331
var obj = EnsureValidEnumerable(parallelAsync);
3432

@@ -53,7 +51,7 @@ public static IAsyncEnumerable<TResult> ForEachAsyncStream<TInput, TResult>(this
5351
/// <returns>The results of the operations</returns>
5452
/// <exception cref="ArgumentNullException">Thrown when either <paramref name="parallelAsync"/> or <paramref name="func"/> is <c>null</c>.</exception>
5553
/// <exception cref="ArgumentOutOfRangeException">Thrown when the configured maximum batch size is a negative number.</exception>
56-
public static IAsyncEnumerable<TResult> ForEachAsyncStream<TInput, TResult>(this IParallelAsyncEnumerable<TInput> parallelAsync, Func<TInput, CancellationToken, Task<TResult>> func, [EnumeratorCancellation] CancellationToken cancellationToken = default)
54+
public static IAsyncEnumerable<TResult> ForEachAsyncStream<TInput, TResult>(this IParallelAsyncEnumerable<TInput> parallelAsync, Func<TInput, CancellationToken, Task<TResult>> func, CancellationToken cancellationToken = default)
5755
{
5856
var obj = EnsureValidEnumerable(parallelAsync);
5957

@@ -69,7 +67,4 @@ public static IAsyncEnumerable<TResult> ForEachAsyncStream<TInput, TResult>(this
6967

7068
#endregion ForEachAsyncStream overloads
7169
}
72-
73-
#endif //NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_0_OR_GREATER
74-
7570
}

src/CSRakowski.Parallel/ParallelAsync.AsyncStreams.cs

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
namespace CSRakowski.Parallel
99
{
10-
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_0_OR_GREATER
11-
1210
public static partial class ParallelAsync
1311
{
1412
#region IEnumerable<T>
@@ -41,12 +39,16 @@ public static partial class ParallelAsync
4139
/// Setting this value to low, will mean a too small list will be allocated and you will have to pay a small performance hit for the resizing of the list during execution.
4240
/// </para>
4341
/// </remarks>
44-
public static IAsyncEnumerable<TResult> ForEachAsyncStream<TResult, TIn>(IEnumerable<TIn> collection, Func<TIn, Task<TResult>> func, int maxBatchSize = 0, bool allowOutOfOrderProcessing = false, int estimatedResultSize = 0, [EnumeratorCancellation] CancellationToken cancellationToken = default)
42+
public static IAsyncEnumerable<TResult> ForEachAsyncStream<TResult, TIn>(IEnumerable<TIn> collection, Func<TIn, Task<TResult>> func, int maxBatchSize = 0, bool allowOutOfOrderProcessing = false, int estimatedResultSize = 0, CancellationToken cancellationToken = default)
4543
{
44+
#if NET8_0_OR_GREATER
45+
ArgumentNullException.ThrowIfNull(func);
46+
#else
4647
if (func == null)
4748
{
4849
throw new ArgumentNullException(nameof(func));
4950
}
51+
#endif //NET8_0_OR_GREATER
5052

5153
var funcWithCancellationToken = WrapFunc(func);
5254
return ForEachAsyncStream<TResult, TIn>(collection, funcWithCancellationToken, maxBatchSize, allowOutOfOrderProcessing, estimatedResultSize, cancellationToken);
@@ -80,8 +82,12 @@ public static IAsyncEnumerable<TResult> ForEachAsyncStream<TResult, TIn>(IEnumer
8082
/// Setting this value to low, will mean a too small list will be allocated and you will have to pay a small performance hit for the resizing of the list during execution.
8183
/// </para>
8284
/// </remarks>
83-
public static IAsyncEnumerable<TResult> ForEachAsyncStream<TResult, TIn>(IEnumerable<TIn> collection, Func<TIn, CancellationToken, Task<TResult>> func, int maxBatchSize = 0, bool allowOutOfOrderProcessing = false, int estimatedResultSize = 0, [EnumeratorCancellation] CancellationToken cancellationToken = default)
85+
public static IAsyncEnumerable<TResult> ForEachAsyncStream<TResult, TIn>(IEnumerable<TIn> collection, Func<TIn, CancellationToken, Task<TResult>> func, int maxBatchSize = 0, bool allowOutOfOrderProcessing = false, int estimatedResultSize = 0, CancellationToken cancellationToken = default)
8486
{
87+
#if NET8_0_OR_GREATER
88+
ArgumentNullException.ThrowIfNull(collection);
89+
ArgumentNullException.ThrowIfNull(func);
90+
#else
8591
if (collection == null)
8692
{
8793
throw new ArgumentNullException(nameof(collection));
@@ -91,6 +97,7 @@ public static IAsyncEnumerable<TResult> ForEachAsyncStream<TResult, TIn>(IEnumer
9197
{
9298
throw new ArgumentNullException(nameof(func));
9399
}
100+
#endif //NET8_0_OR_GREATER
94101

95102
var maxBatchSizeToUse = DetermineBatchSizeToUse(maxBatchSize);
96103

@@ -319,12 +326,16 @@ private static async IAsyncEnumerable<TResult> ForEachAsyncStreamImplUnordered<T
319326
/// Setting this value to low, will mean a too small list will be allocated and you will have to pay a small performance hit for the resizing of the list during execution.
320327
/// </para>
321328
/// </remarks>
322-
public static IAsyncEnumerable<TResult> ForEachAsyncStream<TResult, TIn>(IAsyncEnumerable<TIn> collection, Func<TIn, Task<TResult>> func, int maxBatchSize = 0, bool allowOutOfOrderProcessing = false, int estimatedResultSize = 0, [EnumeratorCancellation] CancellationToken cancellationToken = default)
329+
public static IAsyncEnumerable<TResult> ForEachAsyncStream<TResult, TIn>(IAsyncEnumerable<TIn> collection, Func<TIn, Task<TResult>> func, int maxBatchSize = 0, bool allowOutOfOrderProcessing = false, int estimatedResultSize = 0, CancellationToken cancellationToken = default)
323330
{
331+
#if NET8_0_OR_GREATER
332+
ArgumentNullException.ThrowIfNull(func);
333+
#else
324334
if (func == null)
325335
{
326336
throw new ArgumentNullException(nameof(func));
327337
}
338+
#endif //NET8_0_OR_GREATER
328339

329340
var funcWithCancellationToken = WrapFunc(func);
330341
return ForEachAsyncStream<TResult, TIn>(collection, funcWithCancellationToken, maxBatchSize, allowOutOfOrderProcessing, estimatedResultSize, cancellationToken);
@@ -358,8 +369,12 @@ public static IAsyncEnumerable<TResult> ForEachAsyncStream<TResult, TIn>(IAsyncE
358369
/// Setting this value to low, will mean a too small list will be allocated and you will have to pay a small performance hit for the resizing of the list during execution.
359370
/// </para>
360371
/// </remarks>
361-
public static IAsyncEnumerable<TResult> ForEachAsyncStream<TResult, TIn>(IAsyncEnumerable<TIn> collection, Func<TIn, CancellationToken, Task<TResult>> func, int maxBatchSize = 0, bool allowOutOfOrderProcessing = false, int estimatedResultSize = 0, [EnumeratorCancellation] CancellationToken cancellationToken = default)
372+
public static IAsyncEnumerable<TResult> ForEachAsyncStream<TResult, TIn>(IAsyncEnumerable<TIn> collection, Func<TIn, CancellationToken, Task<TResult>> func, int maxBatchSize = 0, bool allowOutOfOrderProcessing = false, int estimatedResultSize = 0, CancellationToken cancellationToken = default)
362373
{
374+
#if NET8_0_OR_GREATER
375+
ArgumentNullException.ThrowIfNull(collection);
376+
ArgumentNullException.ThrowIfNull(func);
377+
#else
363378
if (collection == null)
364379
{
365380
throw new ArgumentNullException(nameof(collection));
@@ -369,6 +384,7 @@ public static IAsyncEnumerable<TResult> ForEachAsyncStream<TResult, TIn>(IAsyncE
369384
{
370385
throw new ArgumentNullException(nameof(func));
371386
}
387+
#endif //NET8_0_OR_GREATER
372388

373389
int maxBatchSizeToUse = DetermineBatchSizeToUse(maxBatchSize);
374390

@@ -555,8 +571,7 @@ private static async IAsyncEnumerable<TResult> ForEachAsyncStreamImplUnorderedAs
555571
ParallelAsyncEventSource.Log.RunStop(runId);
556572
}
557573

558-
#endregion IAsyncEnumerable<T>
574+
#endregion IAsyncEnumerable<T>
559575
}
560576

561-
#endif //NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_0_OR_GREATER
562577
}

tests/CSRakowski.Parallel.Benchmarks/Benchmarks/ParallelAsyncBenchmarks_AsyncStreams.cs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,11 @@ public async Task<int> IEnumerable_ForEachAsyncStream()
6565
{
6666
int count = 0;
6767

68-
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_0_OR_GREATER
69-
7068
await foreach (var r in ParallelAsync.ForEachAsyncStream(InputNumbers, TestFunctions.JustAddOne_WithCancellationToken, MaxBatchSize, AllowOutOfOrder, NumberOfItemsInCollection, CancellationToken.None))
7169
{
7270
count++;
7371
}
7472

75-
#else
76-
77-
await Task.CompletedTask;
78-
79-
#endif //NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_0_OR_GREATER
80-
8173
return count;
8274
}
8375

@@ -86,18 +78,10 @@ public async Task<int> IAsyncEnumerable_ForEachAsyncStream()
8678
{
8779
int count = 0;
8880

89-
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_0_OR_GREATER
90-
9181
await foreach (var r in ParallelAsync.ForEachAsyncStream(InputNumbersAsync, TestFunctions.JustAddOne_WithCancellationToken, MaxBatchSize, AllowOutOfOrder, NumberOfItemsInCollection, CancellationToken.None))
9282
{
9383
count++;
9484
}
95-
96-
#else
97-
98-
await Task.CompletedTask;
99-
100-
#endif //NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_0_OR_GREATER
10185

10286
return count;
10387
}

tests/CSRakowski.Parallel.Benchmarks/CSRakowski.Parallel.Benchmarks.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
</PropertyGroup>
1111

1212
<ItemGroup>
13-
<PackageReference Include="BenchmarkDotNet" Version="0.15.0" />
13+
<PackageReference Include="BenchmarkDotNet" Version="0.15.6" />
1414
<PackageReference Include="CSRakowski.AsyncStreamsPreparations" Version="1.6.0" />
1515
</ItemGroup>
1616

1717
<ItemGroup Condition=" '$(TargetFrameworkIdentifier)' == '.NETFramework' ">
18-
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows" Version="0.15.0" />
18+
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows" Version="0.15.6" />
1919
</ItemGroup>
2020

2121
<ItemGroup>

tests/CSRakowski.Parallel.Tests/CSRakowski.Parallel.Tests.csproj

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

33
<PropertyGroup>
44
<TargetFrameworks>net48;net472;net90;net80;net60</TargetFrameworks>
@@ -11,9 +11,8 @@
1111
</PropertyGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.0" />
1514
<PackageReference Include="xunit" Version="2.9.3" />
16-
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.8">
15+
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.2">
1716
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1817
<PrivateAssets>all</PrivateAssets>
1918
</PackageReference>
@@ -24,6 +23,13 @@
2423
<PackageReference Include="CSRakowski.AsyncStreamsPreparations" Version="1.6.0" />
2524
</ItemGroup>
2625

26+
<ItemGroup Condition="'$(TargetFramework)' == 'net60'">
27+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
28+
</ItemGroup>
29+
<ItemGroup Condition="'$(TargetFramework)' != 'net60'">
30+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
31+
</ItemGroup>
32+
2733
<ItemGroup>
2834
<ProjectReference Include="..\..\src\CSRakowski.Parallel\CSRakowski.Parallel.csproj" />
2935
</ItemGroup>

tests/CSRakowski.Parallel.Tests/ExtensionMethodsTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ await parallelAsync.ForEachAsync((el) => {
8383
Interlocked.Add(ref sum, el);
8484
Interlocked.Increment(ref count);
8585

86-
return TaskHelper.CompletedTask;
86+
return Task.CompletedTask;
8787
});
8888

8989
Assert.Equal(55, sum);
@@ -106,7 +106,7 @@ await parallelAsync.ForEachAsync((el, ct) => {
106106
Interlocked.Add(ref sum, el);
107107
Interlocked.Increment(ref count);
108108

109-
return TaskHelper.CompletedTask;
109+
return Task.CompletedTask;
110110
});
111111

112112
Assert.Equal(55, sum);

tests/CSRakowski.Parallel.Tests/ExtensionMethodsTests_AsyncStreams.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414

1515
namespace CSRakowski.Parallel.Tests
1616
{
17-
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_0_OR_GREATER
18-
1917
[Collection("ParallelAsync AsyncStreams Extension Methods Tests")]
2018
public class ExtensionMethodsTests_AsyncStreams
2119
{
@@ -128,7 +126,4 @@ public async Task ParallelAsync_Can_Chain_Together_AsyncStreams()
128126
}
129127
}
130128
}
131-
132-
#endif //NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_0_OR_GREATER
133-
134129
}

tests/CSRakowski.Parallel.Tests/ExtensionMethodsTests_IAsyncEnumerable.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ await parallelAsync.ForEachAsync((el) => {
8585
Interlocked.Add(ref sum, el);
8686
Interlocked.Increment(ref count);
8787

88-
return TaskHelper.CompletedTask;
88+
return Task.CompletedTask;
8989
});
9090

9191
Assert.Equal(55, sum);
@@ -108,7 +108,7 @@ await parallelAsync.ForEachAsync((el, ct) => {
108108
Interlocked.Add(ref sum, el);
109109
Interlocked.Increment(ref count);
110110

111-
return TaskHelper.CompletedTask;
111+
return Task.CompletedTask;
112112
});
113113

114114
Assert.Equal(55, sum);

0 commit comments

Comments
 (0)