From 7461a8eea7fe1a4ff9e18efa7ae3a4b62068f3ff Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sun, 29 Sep 2024 19:56:50 -0700 Subject: [PATCH] Fix new .NET SDK warnings --- src/ComputeSharp.D2D1/Shaders/Translation/D3DCompiler.cs | 2 +- src/ComputeSharp.SourceGeneration/Helpers/HashCode.cs | 6 +++--- .../ComputeSharp.D2D1.Tests.SourceGenerators.csproj | 8 ++++++++ .../ComputeSharp.D2D1.WinUI.Tests.SourceGenerators.csproj | 3 +++ .../ComputeSharp.Tests.SourceGenerators.csproj | 3 +++ 5 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/ComputeSharp.D2D1/Shaders/Translation/D3DCompiler.cs b/src/ComputeSharp.D2D1/Shaders/Translation/D3DCompiler.cs index 7550b9a4..5a615899 100644 --- a/src/ComputeSharp.D2D1/Shaders/Translation/D3DCompiler.cs +++ b/src/ComputeSharp.D2D1/Shaders/Translation/D3DCompiler.cs @@ -261,7 +261,7 @@ internal static unsafe partial class D3DCompiler // We cannot use Regex (this method was originally using Regex.Replace(message, @"^[A-Z]:\\[^:]+: (\w+ \w+:)", ...)), because that // causes significant binary size increase, as it's the only thing rooting all the Regex stack across the whole library. So this // code reimplements equivalent logic in a simple way. Because this is a throw helper, allocating a little bit of garbage is fine. - string[] lines = message.Split(new[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries); + string[] lines = message.Split(['\n', '\r'], StringSplitOptions.RemoveEmptyEntries); // Go over each (non empty) line and look for the leading file path to trim away foreach (ref string line in lines.AsSpan()) diff --git a/src/ComputeSharp.SourceGeneration/Helpers/HashCode.cs b/src/ComputeSharp.SourceGeneration/Helpers/HashCode.cs index 7a8ae58b..d11d6d4c 100644 --- a/src/ComputeSharp.SourceGeneration/Helpers/HashCode.cs +++ b/src/ComputeSharp.SourceGeneration/Helpers/HashCode.cs @@ -4,7 +4,7 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security.Cryptography; -#pragma warning disable CS0809, IDE0009, IDE1006, IDE0048 +#pragma warning disable CS0809, IDE0009, IDE1006, IDE0048, CA1065 namespace System; @@ -274,7 +274,7 @@ internal struct HashCode /// The type of the fifth value to combine into the hash code. /// The type of the sixth value to combine into the hash code. /// The type of the seventh value to combine into the hash code. - /// The type of the eigth value to combine into the hash code. + /// The type of the eighth value to combine into the hash code. /// The first value to combine into the hash code. /// The second value to combine into the hash code. /// The third value to combine into the hash code. @@ -282,7 +282,7 @@ internal struct HashCode /// The fifth value to combine into the hash code. /// The sixth value to combine into the hash code. /// The seventh value to combine into the hash code. - /// The eigth value to combine into the hash code. + /// The eighth value to combine into the hash code. /// The hash code that represents the values. public static int Combine(T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8) { diff --git a/tests/ComputeSharp.D2D1.Tests.SourceGenerators/ComputeSharp.D2D1.Tests.SourceGenerators.csproj b/tests/ComputeSharp.D2D1.Tests.SourceGenerators/ComputeSharp.D2D1.Tests.SourceGenerators.csproj index 39e8f601..3083a084 100644 --- a/tests/ComputeSharp.D2D1.Tests.SourceGenerators/ComputeSharp.D2D1.Tests.SourceGenerators.csproj +++ b/tests/ComputeSharp.D2D1.Tests.SourceGenerators/ComputeSharp.D2D1.Tests.SourceGenerators.csproj @@ -2,6 +2,14 @@ net8.0 $(DefineConstants);D2D1_TESTS + + + $(NoWarn);NU1903 diff --git a/tests/ComputeSharp.D2D1.WinUI.Tests.SourceGenerators/ComputeSharp.D2D1.WinUI.Tests.SourceGenerators.csproj b/tests/ComputeSharp.D2D1.WinUI.Tests.SourceGenerators/ComputeSharp.D2D1.WinUI.Tests.SourceGenerators.csproj index bb2b4c08..cc8100bd 100644 --- a/tests/ComputeSharp.D2D1.WinUI.Tests.SourceGenerators/ComputeSharp.D2D1.WinUI.Tests.SourceGenerators.csproj +++ b/tests/ComputeSharp.D2D1.WinUI.Tests.SourceGenerators/ComputeSharp.D2D1.WinUI.Tests.SourceGenerators.csproj @@ -6,6 +6,9 @@ x64;ARM64 win-x64;win-arm64 $(DefineConstants);D2D1_WINUI_TESTS + + + $(NoWarn);NU1902;NU1903 diff --git a/tests/ComputeSharp.Tests.SourceGenerators/ComputeSharp.Tests.SourceGenerators.csproj b/tests/ComputeSharp.Tests.SourceGenerators/ComputeSharp.Tests.SourceGenerators.csproj index 69beecfe..889625e7 100644 --- a/tests/ComputeSharp.Tests.SourceGenerators/ComputeSharp.Tests.SourceGenerators.csproj +++ b/tests/ComputeSharp.Tests.SourceGenerators/ComputeSharp.Tests.SourceGenerators.csproj @@ -1,6 +1,9 @@ net8.0 + + + $(NoWarn);NU1903