diff --git a/src/ComputeSharp.NetStandard/System/Collections.Generic/DictionaryExtensions.cs b/src/ComputeSharp.NetStandard/System/Collections.Generic/DictionaryExtensions.cs index 8cd8686e..3c8199dc 100644 --- a/src/ComputeSharp.NetStandard/System/Collections.Generic/DictionaryExtensions.cs +++ b/src/ComputeSharp.NetStandard/System/Collections.Generic/DictionaryExtensions.cs @@ -14,7 +14,8 @@ internal static class DictionaryExtensions /// The lookup key to use. /// The resulting item, if present. /// Whether or not an item was found with the given key. - public static bool Remove(this Dictionary dictionary, TKey key, out TValue value) + public static bool Remove(this Dictionary dictionary, TKey key, out TValue? value) + where TKey : notnull { if (dictionary.TryGetValue(key, out value)) { diff --git a/src/ComputeSharp.NetStandard/System/Enum.cs b/src/ComputeSharp.NetStandard/System/Enum.cs index 194096bd..6a601cc1 100644 --- a/src/ComputeSharp.NetStandard/System/Enum.cs +++ b/src/ComputeSharp.NetStandard/System/Enum.cs @@ -14,6 +14,6 @@ internal static class Enum public static string GetName(T value) where T : unmanaged, global::System.Enum { - return global::System.Enum.GetName(typeof(T), value); + return global::System.Enum.GetName(typeof(T), value)!; } } \ No newline at end of file diff --git a/tests/ComputeSharp.Tests.Internals/ComputeSharp.Tests.Internals.csproj b/tests/ComputeSharp.Tests.Internals/ComputeSharp.Tests.Internals.csproj index 4faf1cc4..1803a917 100644 --- a/tests/ComputeSharp.Tests.Internals/ComputeSharp.Tests.Internals.csproj +++ b/tests/ComputeSharp.Tests.Internals/ComputeSharp.Tests.Internals.csproj @@ -1,7 +1,7 @@  - net6.0 + netcoreapp3.1;net6.0 false diff --git a/tests/ComputeSharp.Tests.Internals/DebugViewTests.cs b/tests/ComputeSharp.Tests.Internals/DebugViewTests.cs index 2831ede4..9c247059 100644 --- a/tests/ComputeSharp.Tests.Internals/DebugViewTests.cs +++ b/tests/ComputeSharp.Tests.Internals/DebugViewTests.cs @@ -226,7 +226,7 @@ public partial class DebugViewTests { for (int j = 0; j < width; j++) { - data[i, j] = random.NextSingle(); + data[i, j] = (float)random.NextDouble(); } } @@ -279,7 +279,7 @@ public partial class DebugViewTests { for (int j = 0; j < width; j++) { - data[k, i, j] = random.NextSingle(); + data[k, i, j] = (float)random.NextDouble(); } } } diff --git a/tests/ComputeSharp.Tests/Attributes/CombinatorialTestMethodAttribute.cs b/tests/ComputeSharp.Tests/Attributes/CombinatorialTestMethodAttribute.cs index b0465feb..2074a0a5 100644 --- a/tests/ComputeSharp.Tests/Attributes/CombinatorialTestMethodAttribute.cs +++ b/tests/ComputeSharp.Tests/Attributes/CombinatorialTestMethodAttribute.cs @@ -25,7 +25,7 @@ public sealed class CombinatorialTestMethodAttribute : TestMethodAttribute, ITes if (methodInfo.GetCustomAttribute() is not null) { - devices = Enum.GetValues(); + devices = (Device[])Enum.GetValues(typeof(Device)); } else if (methodInfo.GetCustomAttributes().ToArray() is { Length: > 0 } values) { diff --git a/tests/ComputeSharp.Tests/ComputeSharp.Tests.csproj b/tests/ComputeSharp.Tests/ComputeSharp.Tests.csproj index 83731df6..d79eb7de 100644 --- a/tests/ComputeSharp.Tests/ComputeSharp.Tests.csproj +++ b/tests/ComputeSharp.Tests/ComputeSharp.Tests.csproj @@ -1,7 +1,7 @@  - net6.0 + netcoreapp3.1;net6.0 false @@ -21,6 +21,18 @@ PrivateAssets="contentfiles;build"/> + + + + + + + $(NoWarn);CS0649 + + diff --git a/tests/ComputeSharp.Tests/ShadersTests.cs b/tests/ComputeSharp.Tests/ShadersTests.cs index dfebe543..573ab028 100644 --- a/tests/ComputeSharp.Tests/ShadersTests.cs +++ b/tests/ComputeSharp.Tests/ShadersTests.cs @@ -152,7 +152,7 @@ public class ShadersTests using (ReadWriteTexture2D texture = device.Get().AllocateReadWriteTexture2D(imageInfo.Width, imageInfo.Height)) { - if (shaderType.IsAssignableTo(typeof(IComputeShader))) + if (typeof(IComputeShader).IsAssignableFrom(shaderType)) { static void RunComputeShader(ReadWriteTexture2D texture) where T : struct, IComputeShader @@ -219,7 +219,7 @@ public class ShadersTests using (ReadWriteTexture2D texture = device.Get().AllocateReadWriteTexture2D(imageInfo.Width, imageInfo.Height)) { - if (shaderType.IsAssignableTo(typeof(IComputeShader))) + if (typeof(IComputeShader).IsAssignableFrom(shaderType)) { Assert.AreEqual(typeof(TCompute), shaderType);