From b1fb409f733e7249fde33f41bc35a4271bbaa348 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Tue, 18 Jan 2022 11:44:07 +0100 Subject: [PATCH] Fix base type of custom NotSupportedException types --- .../UnsupportedDoubleOperationsException.cs | 12 ++++++------ .../Exceptions/UnsupportedTextureTypeException.cs | 4 ++-- .../Graphics/Resources/Abstract/Buffer{T}.cs | 2 +- tests/ComputeSharp.Tests/BufferTests.cs | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/ComputeSharp/Graphics/Exceptions/UnsupportedDoubleOperationsException.cs b/src/ComputeSharp/Graphics/Exceptions/UnsupportedDoubleOperationsException.cs index bd60a020..5a6414b2 100644 --- a/src/ComputeSharp/Graphics/Exceptions/UnsupportedDoubleOperationsException.cs +++ b/src/ComputeSharp/Graphics/Exceptions/UnsupportedDoubleOperationsException.cs @@ -4,15 +4,15 @@ using System.Text; namespace ComputeSharp.Exceptions; /// -/// A custom that indicates when a resource was attempted to be created with an unsupported type. +/// A custom that indicates when a resource was attempted to be created with an unsupported type. /// -public sealed class UnsupportedDoubleOperationsException : InvalidOperationException +public sealed class UnsupportedDoubleOperationException : NotSupportedException { /// - /// Creates a new instance. + /// Creates a new instance. /// /// The message that describes the error. - private UnsupportedDoubleOperationsException(string message) + private UnsupportedDoubleOperationException(string message) : base(message) { } @@ -22,7 +22,7 @@ public sealed class UnsupportedDoubleOperationsException : InvalidOperationExcep /// /// The element type of resource that was being created. /// A new instance with a formatted error message. - private static UnsupportedDoubleOperationsException Create(Type type) + private static UnsupportedDoubleOperationException Create(Type type) { StringBuilder builder = new(256); @@ -35,7 +35,7 @@ public sealed class UnsupportedDoubleOperationsException : InvalidOperationExcep } /// - /// Throws a new instance from the specified parameters. + /// Throws a new instance from the specified parameters. /// /// The type of values in the resource that couldn't be created. internal static void Throw() diff --git a/src/ComputeSharp/Graphics/Exceptions/UnsupportedTextureTypeException.cs b/src/ComputeSharp/Graphics/Exceptions/UnsupportedTextureTypeException.cs index cd1de840..c030d592 100644 --- a/src/ComputeSharp/Graphics/Exceptions/UnsupportedTextureTypeException.cs +++ b/src/ComputeSharp/Graphics/Exceptions/UnsupportedTextureTypeException.cs @@ -5,9 +5,9 @@ using Microsoft.Toolkit.Diagnostics; namespace ComputeSharp.Exceptions; /// -/// A custom that indicates when a texture was attempted to be created with an unsupported type. +/// A custom that indicates when a texture was attempted to be created with an unsupported type. /// -public sealed class UnsupportedTextureTypeException : InvalidOperationException +public sealed class UnsupportedTextureTypeException : NotSupportedException { /// /// Creates a new instance. diff --git a/src/ComputeSharp/Graphics/Resources/Abstract/Buffer{T}.cs b/src/ComputeSharp/Graphics/Resources/Abstract/Buffer{T}.cs index e15f3cea..62ae44b3 100644 --- a/src/ComputeSharp/Graphics/Resources/Abstract/Buffer{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Abstract/Buffer{T}.cs @@ -79,7 +79,7 @@ public unsafe abstract class Buffer : NativeObject, IGraphicsResource if (TypeInfo.IsDoubleOrContainsDoubles && device.D3D12Device->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS).DoublePrecisionFloatShaderOps == 0) { - UnsupportedDoubleOperationsException.Throw(); + UnsupportedDoubleOperationException.Throw(); } nint usableSizeInBytes = checked((nint)(length * elementSizeInBytes)); diff --git a/tests/ComputeSharp.Tests/BufferTests.cs b/tests/ComputeSharp.Tests/BufferTests.cs index ad49d19e..39370cfc 100644 --- a/tests/ComputeSharp.Tests/BufferTests.cs +++ b/tests/ComputeSharp.Tests/BufferTests.cs @@ -414,7 +414,7 @@ public partial class BufferTests [Resource(typeof(ConstantBuffer<>))] [Resource(typeof(ReadOnlyBuffer<>))] [Resource(typeof(ReadWriteBuffer<>))] - [ExpectedException(typeof(UnsupportedDoubleOperationsException))] + [ExpectedException(typeof(UnsupportedDoubleOperationException))] public void Dispatch_ReadWriteBuffer_DoublePrecision_ThrowsExceptionIfUnsupported(Device device, Type resourceType) { if (device.Get().IsDoublePrecisionSupportAvailable())