diff --git a/samples/ComputeSharp.Benchmark/ComputeSharp.Benchmark.csproj b/samples/ComputeSharp.Benchmark/ComputeSharp.Benchmark.csproj index 48960701..62d4ca10 100644 --- a/samples/ComputeSharp.Benchmark/ComputeSharp.Benchmark.csproj +++ b/samples/ComputeSharp.Benchmark/ComputeSharp.Benchmark.csproj @@ -19,7 +19,6 @@ - diff --git a/samples/ComputeSharp.ImageProcessing/ComputeSharp.ImageProcessing.csproj b/samples/ComputeSharp.ImageProcessing/ComputeSharp.ImageProcessing.csproj index 4294295b..ba5381c6 100644 --- a/samples/ComputeSharp.ImageProcessing/ComputeSharp.ImageProcessing.csproj +++ b/samples/ComputeSharp.ImageProcessing/ComputeSharp.ImageProcessing.csproj @@ -10,7 +10,6 @@ - diff --git a/samples/ComputeSharp.ImageProcessing/Processors/HlslBokehBlurProcessor.Implementation.cs b/samples/ComputeSharp.ImageProcessing/Processors/HlslBokehBlurProcessor.Implementation.cs index 3056d165..4dfd3b69 100644 --- a/samples/ComputeSharp.ImageProcessing/Processors/HlslBokehBlurProcessor.Implementation.cs +++ b/samples/ComputeSharp.ImageProcessing/Processors/HlslBokehBlurProcessor.Implementation.cs @@ -3,7 +3,6 @@ using System.Collections.Concurrent; using System.Numerics; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -using CommunityToolkit.Diagnostics; using SixLabors.ImageSharp; using SixLabors.ImageSharp.Processing.Processors; using ImageSharpRgba32 = SixLabors.ImageSharp.PixelFormats.Rgba32; @@ -260,7 +259,7 @@ public sealed partial class HlslBokehBlurProcessor { if (!source.DangerousTryGetSinglePixelMemory(out Memory pixelMemory)) { - ThrowHelper.ThrowInvalidOperationException("Cannot process image frames wrapping discontiguous memory."); + throw new ArgumentException("Cannot process image frames wrapping discontiguous memory."); } Span span = MemoryMarshal.Cast(pixelMemory.Span); diff --git a/samples/ComputeSharp.ImageProcessing/Processors/HlslBokehBlurProcessor.cs b/samples/ComputeSharp.ImageProcessing/Processors/HlslBokehBlurProcessor.cs index f1aac6fb..75af7ff6 100644 --- a/samples/ComputeSharp.ImageProcessing/Processors/HlslBokehBlurProcessor.cs +++ b/samples/ComputeSharp.ImageProcessing/Processors/HlslBokehBlurProcessor.cs @@ -1,5 +1,5 @@ +using System; using System.Runtime.CompilerServices; -using CommunityToolkit.Diagnostics; using SixLabors.ImageSharp; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing.Processors; @@ -76,7 +76,7 @@ public sealed partial class HlslBokehBlurProcessor : IImageProcessor { if (typeof(TPixel) != typeof(ImageSharpRgba32)) { - ThrowHelper.ThrowInvalidOperationException("This processor only supports the RGBA32 pixel format."); + throw new NotSupportedException("This processor only supports the RGBA32 pixel format."); } Implementation processor = new(this, configuration, Unsafe.As>(source), sourceRectangle); diff --git a/samples/ComputeSharp.ImageProcessing/Processors/HlslGaussianBlurProcessor.Implementation.cs b/samples/ComputeSharp.ImageProcessing/Processors/HlslGaussianBlurProcessor.Implementation.cs index 337c4de3..f8cdfa64 100644 --- a/samples/ComputeSharp.ImageProcessing/Processors/HlslGaussianBlurProcessor.Implementation.cs +++ b/samples/ComputeSharp.ImageProcessing/Processors/HlslGaussianBlurProcessor.Implementation.cs @@ -1,7 +1,6 @@ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -using CommunityToolkit.Diagnostics; using SixLabors.ImageSharp; using SixLabors.ImageSharp.Processing.Processors; using ImageSharpRgba32 = SixLabors.ImageSharp.PixelFormats.Rgba32; @@ -95,7 +94,7 @@ public sealed partial class HlslGaussianBlurProcessor { if (!source.DangerousTryGetSinglePixelMemory(out Memory pixelMemory)) { - ThrowHelper.ThrowInvalidOperationException("Cannot process image frames wrapping discontiguous memory."); + throw new ArgumentException("Cannot process image frames wrapping discontiguous memory."); } Span span = MemoryMarshal.Cast(pixelMemory.Span); diff --git a/samples/ComputeSharp.ImageProcessing/Processors/HlslGaussianBlurProcessor.cs b/samples/ComputeSharp.ImageProcessing/Processors/HlslGaussianBlurProcessor.cs index 51e4294f..5e2bff21 100644 --- a/samples/ComputeSharp.ImageProcessing/Processors/HlslGaussianBlurProcessor.cs +++ b/samples/ComputeSharp.ImageProcessing/Processors/HlslGaussianBlurProcessor.cs @@ -1,5 +1,5 @@ +using System; using System.Runtime.CompilerServices; -using CommunityToolkit.Diagnostics; using SixLabors.ImageSharp; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing.Processors; @@ -81,7 +81,7 @@ public sealed partial class HlslGaussianBlurProcessor : IImageProcessor { if (typeof(TPixel) != typeof(ImageSharpRgba32)) { - ThrowHelper.ThrowInvalidOperationException("This processor only supports the RGBA32 pixel format."); + throw new NotSupportedException("This processor only supports the RGBA32 pixel format."); } Implementation processor = new(this, configuration, Unsafe.As>(source), sourceRectangle); diff --git a/samples/ComputeSharp.SwapChain.WinUI/ComputeSharp.SwapChain.WinUI.csproj b/samples/ComputeSharp.SwapChain.WinUI/ComputeSharp.SwapChain.WinUI.csproj index 0e246b8f..b796eefd 100644 --- a/samples/ComputeSharp.SwapChain.WinUI/ComputeSharp.SwapChain.WinUI.csproj +++ b/samples/ComputeSharp.SwapChain.WinUI/ComputeSharp.SwapChain.WinUI.csproj @@ -30,7 +30,6 @@ - diff --git a/tests/ComputeSharp.Tests.DeviceLost/ComputeSharp.Tests.DeviceLost.csproj b/tests/ComputeSharp.Tests.DeviceLost/ComputeSharp.Tests.DeviceLost.csproj index b937f272..cdcd3a9c 100644 --- a/tests/ComputeSharp.Tests.DeviceLost/ComputeSharp.Tests.DeviceLost.csproj +++ b/tests/ComputeSharp.Tests.DeviceLost/ComputeSharp.Tests.DeviceLost.csproj @@ -11,7 +11,6 @@ - diff --git a/tests/ComputeSharp.Tests.DeviceLost/Extensions/DeviceExtensions.cs b/tests/ComputeSharp.Tests.DeviceLost/Extensions/DeviceExtensions.cs index d3910436..9847e6f5 100644 --- a/tests/ComputeSharp.Tests.DeviceLost/Extensions/DeviceExtensions.cs +++ b/tests/ComputeSharp.Tests.DeviceLost/Extensions/DeviceExtensions.cs @@ -1,5 +1,5 @@ +using System; using System.Linq; -using CommunityToolkit.Diagnostics; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace ComputeSharp.Tests.Extensions; @@ -21,7 +21,7 @@ public static class DeviceExtensions { Device.Discrete => GraphicsDevice.QueryDevices(info => info.IsHardwareAccelerated).FirstOrDefault(), Device.Warp => GraphicsDevice.QueryDevices(info => !info.IsHardwareAccelerated).FirstOrDefault(), - _ => ThrowHelper.ThrowArgumentException("Invalid device.") + _ => throw new ArgumentException("Invalid device type.", nameof(type)) }; if (device is null) diff --git a/tests/ComputeSharp.Tests.DisableDynamicCompilation/ComputeSharp.Tests.DisableDynamicCompilation.csproj b/tests/ComputeSharp.Tests.DisableDynamicCompilation/ComputeSharp.Tests.DisableDynamicCompilation.csproj index 8203cdb7..2a5f9d8c 100644 --- a/tests/ComputeSharp.Tests.DisableDynamicCompilation/ComputeSharp.Tests.DisableDynamicCompilation.csproj +++ b/tests/ComputeSharp.Tests.DisableDynamicCompilation/ComputeSharp.Tests.DisableDynamicCompilation.csproj @@ -6,7 +6,6 @@ - diff --git a/tests/ComputeSharp.Tests.Internals/ComputeSharp.Tests.Internals.csproj b/tests/ComputeSharp.Tests.Internals/ComputeSharp.Tests.Internals.csproj index 5ba2fef8..1ec91b4e 100644 --- a/tests/ComputeSharp.Tests.Internals/ComputeSharp.Tests.Internals.csproj +++ b/tests/ComputeSharp.Tests.Internals/ComputeSharp.Tests.Internals.csproj @@ -6,7 +6,6 @@ - diff --git a/tests/ComputeSharp.Tests/ComputeSharp.Tests.csproj b/tests/ComputeSharp.Tests/ComputeSharp.Tests.csproj index 1b136057..fb7fe66d 100644 --- a/tests/ComputeSharp.Tests/ComputeSharp.Tests.csproj +++ b/tests/ComputeSharp.Tests/ComputeSharp.Tests.csproj @@ -11,7 +11,6 @@ - diff --git a/tests/ComputeSharp.Tests/Extensions/DeviceExtensions.cs b/tests/ComputeSharp.Tests/Extensions/DeviceExtensions.cs index 111bf9e8..58b4c630 100644 --- a/tests/ComputeSharp.Tests/Extensions/DeviceExtensions.cs +++ b/tests/ComputeSharp.Tests/Extensions/DeviceExtensions.cs @@ -1,5 +1,5 @@ +using System; using System.Linq; -using CommunityToolkit.Diagnostics; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace ComputeSharp.Tests.Extensions; @@ -40,7 +40,7 @@ public static class DeviceExtensions { Device.Discrete => DiscreteDevice, Device.Warp => WarpDevice, - _ => ThrowHelper.ThrowArgumentException("Invalid device.") + _ => throw new ArgumentException("Invalid device type.", nameof(type)) }; if (device is null) diff --git a/tests/ComputeSharp.Tests/Extensions/ImagingExtensions.cs b/tests/ComputeSharp.Tests/Extensions/ImagingExtensions.cs index 1c1e75c3..854e69dd 100644 --- a/tests/ComputeSharp.Tests/Extensions/ImagingExtensions.cs +++ b/tests/ComputeSharp.Tests/Extensions/ImagingExtensions.cs @@ -1,6 +1,5 @@ using System; using System.Runtime.InteropServices; -using CommunityToolkit.Diagnostics; using ComputeSharp.Resources; using Microsoft.VisualStudio.TestTools.UnitTesting; using SixLabors.ImageSharp; @@ -24,7 +23,7 @@ public static class ImagingExtensions where TFrom : unmanaged where TTo : unmanaged, IPixel { - Guard.IsEqualTo(sizeof(TTo), sizeof(TFrom), nameof(TTo)); + ArgumentOutOfRangeException.ThrowIfNotEqual(sizeof(TTo), sizeof(TFrom), nameof(TTo)); Image image = new(texture.Width, texture.Height); @@ -49,7 +48,7 @@ public static class ImagingExtensions where TFrom : unmanaged where TTo : unmanaged, IPixel { - Guard.IsEqualTo(sizeof(TTo), sizeof(TFrom), nameof(TTo)); + ArgumentOutOfRangeException.ThrowIfNotEqual(sizeof(TTo), sizeof(TFrom), nameof(TTo)); Image image = new(texture.Width, texture.Height);