Skip to content

Commit 1ba38db

Browse files
committed
Merge branch 'master' into Updated_TargetFrameworks
2 parents 21a6246 + 5f9a43d commit 1ba38db

File tree

5 files changed

+45
-10
lines changed

5 files changed

+45
-10
lines changed

SECURITY.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Security Policy
2+
3+
## Reporting a Vulnerability
4+
5+
If you discover a security vulnerability in this project, please report it responsibly:
6+
7+
- Create a public issue in the project's issue tracker with a basic highlevel description to notify the maintainers.
8+
- **Do Not** disclose any sensitive details in the issue.
9+
- Leave contact information in the issue so the maintainers can reach you for more details.
10+
- You will receive a response as soon as possible, typically within 7 days.
11+
- After the issue is resolved, you may be credited in the release notes if you wish.
12+
13+
We appreciate your help in keeping this project and its users safe!

src/CSRakowski.Parallel/CSRakowski.Parallel.csproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@
2121
<AssemblyName>CSRakowski.Parallel</AssemblyName>
2222
</PropertyGroup>
2323

24+
<PropertyGroup>
25+
<!-- Suppress "NETSDK1215: Targeting .NET Standard prior to 2.0 is no longer recommended." This is expected for legacy compatibility. -->
26+
<NoWarn>$(NoWarn);NETSDK1215</NoWarn>
27+
</PropertyGroup>
28+
2429
<PropertyGroup>
2530
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\CSRakowski.Parallel.xml</DocumentationFile>
2631
</PropertyGroup>

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public static partial class ParallelAsyncEx
2828
/// <returns>The results of the operations</returns>
2929
/// <exception cref="ArgumentNullException">Thrown when either <paramref name="parallelAsync"/> or <paramref name="func"/> is <c>null</c>.</exception>
3030
/// <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)
31+
public static IAsyncEnumerable<TResult> ForEachAsyncStream<TInput, TResult>(this IParallelAsyncEnumerable<TInput> parallelAsync, Func<TInput, Task<TResult>> func, CancellationToken cancellationToken = default)
3232
{
3333
var obj = EnsureValidEnumerable(parallelAsync);
3434

@@ -53,7 +53,7 @@ public static IAsyncEnumerable<TResult> ForEachAsyncStream<TInput, TResult>(this
5353
/// <returns>The results of the operations</returns>
5454
/// <exception cref="ArgumentNullException">Thrown when either <paramref name="parallelAsync"/> or <paramref name="func"/> is <c>null</c>.</exception>
5555
/// <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)
56+
public static IAsyncEnumerable<TResult> ForEachAsyncStream<TInput, TResult>(this IParallelAsyncEnumerable<TInput> parallelAsync, Func<TInput, CancellationToken, Task<TResult>> func, CancellationToken cancellationToken = default)
5757
{
5858
var obj = EnsureValidEnumerable(parallelAsync);
5959

@@ -71,5 +71,4 @@ public static IAsyncEnumerable<TResult> ForEachAsyncStream<TInput, TResult>(this
7171
}
7272

7373
#endif //NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_0_OR_GREATER
74-
7574
}

src/CSRakowski.Parallel/ParallelAsync.AsyncStreams.cs

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,16 @@ public static partial class ParallelAsync
4141
/// 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.
4242
/// </para>
4343
/// </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)
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, CancellationToken cancellationToken = default)
4545
{
46+
#if NET8_0_OR_GREATER
47+
ArgumentNullException.ThrowIfNull(func);
48+
#else
4649
if (func == null)
4750
{
4851
throw new ArgumentNullException(nameof(func));
4952
}
53+
#endif //NET8_0_OR_GREATER
5054

5155
var funcWithCancellationToken = WrapFunc(func);
5256
return ForEachAsyncStream<TResult, TIn>(collection, funcWithCancellationToken, maxBatchSize, allowOutOfOrderProcessing, estimatedResultSize, cancellationToken);
@@ -80,8 +84,12 @@ public static IAsyncEnumerable<TResult> ForEachAsyncStream<TResult, TIn>(IEnumer
8084
/// 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.
8185
/// </para>
8286
/// </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)
87+
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)
8488
{
89+
#if NET8_0_OR_GREATER
90+
ArgumentNullException.ThrowIfNull(collection);
91+
ArgumentNullException.ThrowIfNull(func);
92+
#else
8593
if (collection == null)
8694
{
8795
throw new ArgumentNullException(nameof(collection));
@@ -91,6 +99,7 @@ public static IAsyncEnumerable<TResult> ForEachAsyncStream<TResult, TIn>(IEnumer
9199
{
92100
throw new ArgumentNullException(nameof(func));
93101
}
102+
#endif //NET8_0_OR_GREATER
94103

95104
var maxBatchSizeToUse = DetermineBatchSizeToUse(maxBatchSize);
96105

@@ -319,12 +328,16 @@ private static async IAsyncEnumerable<TResult> ForEachAsyncStreamImplUnordered<T
319328
/// 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.
320329
/// </para>
321330
/// </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)
331+
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)
323332
{
333+
#if NET8_0_OR_GREATER
334+
ArgumentNullException.ThrowIfNull(func);
335+
#else
324336
if (func == null)
325337
{
326338
throw new ArgumentNullException(nameof(func));
327339
}
340+
#endif //NET8_0_OR_GREATER
328341

329342
var funcWithCancellationToken = WrapFunc(func);
330343
return ForEachAsyncStream<TResult, TIn>(collection, funcWithCancellationToken, maxBatchSize, allowOutOfOrderProcessing, estimatedResultSize, cancellationToken);
@@ -358,8 +371,12 @@ public static IAsyncEnumerable<TResult> ForEachAsyncStream<TResult, TIn>(IAsyncE
358371
/// 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.
359372
/// </para>
360373
/// </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)
374+
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)
362375
{
376+
#if NET8_0_OR_GREATER
377+
ArgumentNullException.ThrowIfNull(collection);
378+
ArgumentNullException.ThrowIfNull(func);
379+
#else
363380
if (collection == null)
364381
{
365382
throw new ArgumentNullException(nameof(collection));
@@ -369,6 +386,7 @@ public static IAsyncEnumerable<TResult> ForEachAsyncStream<TResult, TIn>(IAsyncE
369386
{
370387
throw new ArgumentNullException(nameof(func));
371388
}
389+
#endif //NET8_0_OR_GREATER
372390

373391
int maxBatchSizeToUse = DetermineBatchSizeToUse(maxBatchSize);
374392

@@ -555,8 +573,8 @@ private static async IAsyncEnumerable<TResult> ForEachAsyncStreamImplUnorderedAs
555573
ParallelAsyncEventSource.Log.RunStop(runId);
556574
}
557575

558-
#endregion IAsyncEnumerable<T>
576+
#endregion IAsyncEnumerable<T>
559577
}
560578

561579
#endif //NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_0_OR_GREATER
562-
}
580+
}

tests/Profiling/Profiling.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,4 @@
7272
</PackageReference>
7373
</ItemGroup>
7474
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
75-
</Project>
75+
</Project>

0 commit comments

Comments
 (0)