Skip to content

Commit 381a42f

Browse files
committed
Workaround warnings that only occur in .NET 5 and are fixed in .NET 6 SDK
1 parent 74fa5d1 commit 381a42f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Source/Common/OneOrMany{T}.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ public readonly struct OneOrMany<T>
2323
/// <param name="item">The single item value.</param>
2424
public OneOrMany(T item)
2525
{
26+
#pragma warning disable CA1508 // TODO: Remove this suppression in .NET 6 where the warning is fixed.
2627
if (item is null || (item is string itemAsString && string.IsNullOrWhiteSpace(itemAsString)))
28+
#pragma warning restore CA1508 // TODO: Remove this suppression in .NET 6 where the warning is fixed.
2729
{
2830
this.collection = null;
2931
this.HasOne = false;
@@ -51,7 +53,9 @@ public OneOrMany(ReadOnlySpan<T> span)
5153
for (var i = 0; i < span.Length; i++)
5254
{
5355
var item = span[i];
56+
#pragma warning disable CA1508 // TODO: Remove this suppression in .NET 6 where the warning is fixed.
5457
if (!string.IsNullOrWhiteSpace(item as string))
58+
#pragma warning restore CA1508 // TODO: Remove this suppression in .NET 6 where the warning is fixed.
5559
{
5660
items[index] = item;
5761
index++;
@@ -63,7 +67,9 @@ public OneOrMany(ReadOnlySpan<T> span)
6367
for (var i = 0; i < span.Length; i++)
6468
{
6569
var item = span[i];
70+
#pragma warning disable CA1508 // TODO: Remove this suppression in .NET 6 where the warning is fixed.
6671
if (item is not null)
72+
#pragma warning restore CA1508 // TODO: Remove this suppression in .NET 6 where the warning is fixed.
6773
{
6874
items[index] = item;
6975
index++;

0 commit comments

Comments
 (0)