diff --git a/shared-infrastructure b/shared-infrastructure
index f79b8d073a..bf398a9b6b 160000
--- a/shared-infrastructure
+++ b/shared-infrastructure
@@ -1 +1 @@
-Subproject commit f79b8d073aeb2deb4cb095a9d4b94aa2be26c848
+Subproject commit bf398a9b6bb6d0acfe0525ee109276b4ef74646c
diff --git a/src/ImageSharp/Compression/Zlib/DeflateThrowHelper.cs b/src/ImageSharp/Compression/Zlib/DeflateThrowHelper.cs
index 8097c4e31d..ba22d5d85e 100644
--- a/src/ImageSharp/Compression/Zlib/DeflateThrowHelper.cs
+++ b/src/ImageSharp/Compression/Zlib/DeflateThrowHelper.cs
@@ -1,33 +1,23 @@
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
-using System.Runtime.CompilerServices;
-
namespace SixLabors.ImageSharp.Compression.Zlib;
internal static class DeflateThrowHelper
{
- [MethodImpl(InliningOptions.ColdPath)]
public static void ThrowAlreadyFinished() => throw new InvalidOperationException("Finish() already called.");
- [MethodImpl(InliningOptions.ColdPath)]
public static void ThrowAlreadyClosed() => throw new InvalidOperationException("Deflator already closed.");
- [MethodImpl(InliningOptions.ColdPath)]
public static void ThrowUnknownCompression() => throw new InvalidOperationException("Unknown compression function.");
- [MethodImpl(InliningOptions.ColdPath)]
public static void ThrowNotProcessed() => throw new InvalidOperationException("Old input was not completely processed.");
- [MethodImpl(InliningOptions.ColdPath)]
public static void ThrowNull(string name) => throw new ArgumentNullException(name);
- [MethodImpl(InliningOptions.ColdPath)]
public static void ThrowOutOfRange(string name) => throw new ArgumentOutOfRangeException(name);
- [MethodImpl(InliningOptions.ColdPath)]
public static void ThrowHeapViolated() => throw new InvalidOperationException("Huffman heap invariant violated.");
- [MethodImpl(InliningOptions.ColdPath)]
public static void ThrowNoDeflate() => throw new ImageFormatException("Cannot deflate all input.");
}
diff --git a/src/ImageSharp/Formats/Bmp/BmpThrowHelper.cs b/src/ImageSharp/Formats/Bmp/BmpThrowHelper.cs
index 2137f54dc0..c0bd1d5489 100644
--- a/src/ImageSharp/Formats/Bmp/BmpThrowHelper.cs
+++ b/src/ImageSharp/Formats/Bmp/BmpThrowHelper.cs
@@ -1,25 +1,13 @@
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
-using System.Runtime.CompilerServices;
-
namespace SixLabors.ImageSharp.Formats.Bmp;
internal static class BmpThrowHelper
{
- ///
- /// Cold path optimization for throwing 's
- ///
- /// The error message for the exception.
- [MethodImpl(MethodImplOptions.NoInlining)]
public static void ThrowInvalidImageContentException(string errorMessage)
=> throw new InvalidImageContentException(errorMessage);
- ///
- /// Cold path optimization for throwing 's
- ///
- /// The error message for the exception.
- [MethodImpl(MethodImplOptions.NoInlining)]
public static void ThrowNotSupportedException(string errorMessage)
=> throw new NotSupportedException(errorMessage);
}
diff --git a/src/ImageSharp/Formats/Gif/GifThrowHelper.cs b/src/ImageSharp/Formats/Gif/GifThrowHelper.cs
index 5ba1da6b5c..1a3a86c8dc 100644
--- a/src/ImageSharp/Formats/Gif/GifThrowHelper.cs
+++ b/src/ImageSharp/Formats/Gif/GifThrowHelper.cs
@@ -1,26 +1,12 @@
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
-using System.Runtime.CompilerServices;
-
namespace SixLabors.ImageSharp.Formats.Gif;
internal static class GifThrowHelper
{
- ///
- /// Cold path optimization for throwing 's
- ///
- /// The error message for the exception.
- [MethodImpl(InliningOptions.ColdPath)]
public static void ThrowInvalidImageContentException(string errorMessage)
=> throw new InvalidImageContentException(errorMessage);
- ///
- /// Cold path optimization for throwing 's.
- ///
- /// The error message for the exception.
- /// The exception that is the cause of the current exception, or a null reference
- /// if no inner exception is specified.
- [MethodImpl(InliningOptions.ColdPath)]
public static void ThrowInvalidImageContentException(string errorMessage, Exception innerException) => throw new InvalidImageContentException(errorMessage, innerException);
}
diff --git a/src/ImageSharp/Formats/Jpeg/JpegThrowHelper.cs b/src/ImageSharp/Formats/Jpeg/JpegThrowHelper.cs
index 19eedf9f1d..ab3f7b0b81 100644
--- a/src/ImageSharp/Formats/Jpeg/JpegThrowHelper.cs
+++ b/src/ImageSharp/Formats/Jpeg/JpegThrowHelper.cs
@@ -1,56 +1,33 @@
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
-using System.Runtime.CompilerServices;
-
namespace SixLabors.ImageSharp.Formats.Jpeg;
internal static class JpegThrowHelper
{
- ///
- /// Cold path optimization for throwing 's.
- ///
- /// The error message for the exception.
- [MethodImpl(InliningOptions.ColdPath)]
public static void ThrowNotSupportedException(string errorMessage) => throw new NotSupportedException(errorMessage);
- ///
- /// Cold path optimization for throwing 's.
- ///
- /// The error message for the exception.
- [MethodImpl(InliningOptions.ColdPath)]
public static void ThrowInvalidImageContentException(string errorMessage) => throw new InvalidImageContentException(errorMessage);
- [MethodImpl(InliningOptions.ColdPath)]
public static void ThrowBadMarker(string marker, int length) => throw new InvalidImageContentException($"Marker {marker} has bad length {length}.");
- [MethodImpl(InliningOptions.ColdPath)]
public static void ThrowNotEnoughBytesForMarker(byte marker) => throw new InvalidImageContentException($"Input stream does not have enough bytes to parse declared contents of the {marker:X2} marker.");
- [MethodImpl(InliningOptions.ColdPath)]
public static void ThrowBadQuantizationTableIndex(int index) => throw new InvalidImageContentException($"Bad Quantization Table index {index}.");
- [MethodImpl(InliningOptions.ColdPath)]
public static void ThrowBadQuantizationTablePrecision(int precision) => throw new InvalidImageContentException($"Unknown Quantization Table precision {precision}.");
- [MethodImpl(InliningOptions.ColdPath)]
public static void ThrowBadSampling() => throw new InvalidImageContentException("Bad sampling factor.");
- [MethodImpl(InliningOptions.ColdPath)]
public static void ThrowBadSampling(int factor) => throw new InvalidImageContentException($"Bad sampling factor: {factor}");
- [MethodImpl(InliningOptions.ColdPath)]
public static void ThrowBadProgressiveScan(int ss, int se, int ah, int al) => throw new InvalidImageContentException($"Invalid progressive parameters Ss={ss} Se={se} Ah={ah} Al={al}.");
- [MethodImpl(InliningOptions.ColdPath)]
public static void ThrowInvalidImageDimensions(int width, int height) => throw new InvalidImageContentException($"Invalid image dimensions: {width}x{height}.");
- [MethodImpl(InliningOptions.ColdPath)]
public static void ThrowDimensionsTooLarge(int width, int height) => throw new ImageFormatException($"Image is too large to encode at {width}x{height} for JPEG format.");
- [MethodImpl(InliningOptions.ColdPath)]
public static void ThrowNotSupportedComponentCount(int componentCount) => throw new NotSupportedException($"Images with {componentCount} components are not supported.");
- [MethodImpl(InliningOptions.ColdPath)]
public static void ThrowNotSupportedColorSpace() => throw new NotSupportedException("Image color space could not be deduced.");
}
diff --git a/src/ImageSharp/Formats/Png/PngThrowHelper.cs b/src/ImageSharp/Formats/Png/PngThrowHelper.cs
index b7ca55b2bf..67da78e45b 100644
--- a/src/ImageSharp/Formats/Png/PngThrowHelper.cs
+++ b/src/ImageSharp/Formats/Png/PngThrowHelper.cs
@@ -2,49 +2,36 @@
// Licensed under the Six Labors Split License.
using System.Diagnostics.CodeAnalysis;
-using System.Runtime.CompilerServices;
namespace SixLabors.ImageSharp.Formats.Png;
-///
-/// Cold path optimizations for throwing png format based exceptions.
-///
internal static class PngThrowHelper
{
[DoesNotReturn]
- [MethodImpl(InliningOptions.ColdPath)]
public static void ThrowInvalidImageContentException(string errorMessage, Exception innerException)
=> throw new InvalidImageContentException(errorMessage, innerException);
[DoesNotReturn]
- [MethodImpl(InliningOptions.ColdPath)]
public static void ThrowNoHeader() => throw new InvalidImageContentException("PNG Image does not contain a header chunk");
[DoesNotReturn]
- [MethodImpl(InliningOptions.ColdPath)]
public static void ThrowNoData() => throw new InvalidImageContentException("PNG Image does not contain a data chunk");
[DoesNotReturn]
- [MethodImpl(InliningOptions.ColdPath)]
public static void ThrowMissingPalette() => throw new InvalidImageContentException("PNG Image does not contain a palette chunk");
[DoesNotReturn]
- [MethodImpl(InliningOptions.ColdPath)]
public static void ThrowInvalidChunkType() => throw new InvalidImageContentException("Invalid PNG data.");
[DoesNotReturn]
- [MethodImpl(InliningOptions.ColdPath)]
public static void ThrowInvalidChunkType(string message) => throw new InvalidImageContentException(message);
[DoesNotReturn]
- [MethodImpl(InliningOptions.ColdPath)]
public static void ThrowInvalidChunkCrc(string chunkTypeName) => throw new InvalidImageContentException($"CRC Error. PNG {chunkTypeName} chunk is corrupt!");
[DoesNotReturn]
- [MethodImpl(InliningOptions.ColdPath)]
public static void ThrowNotSupportedColor() => throw new NotSupportedException("Unsupported PNG color type");
[DoesNotReturn]
- [MethodImpl(InliningOptions.ColdPath)]
public static void ThrowUnknownFilter() => throw new InvalidImageContentException("Unknown filter type.");
}
diff --git a/src/ImageSharp/Formats/Tga/TgaThrowHelper.cs b/src/ImageSharp/Formats/Tga/TgaThrowHelper.cs
index e2ab502259..67398c92f7 100644
--- a/src/ImageSharp/Formats/Tga/TgaThrowHelper.cs
+++ b/src/ImageSharp/Formats/Tga/TgaThrowHelper.cs
@@ -1,35 +1,16 @@
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
-using System.Runtime.CompilerServices;
-
namespace SixLabors.ImageSharp.Formats.Tga;
internal static class TgaThrowHelper
{
- ///
- /// Cold path optimization for throwing 's
- ///
- /// The error message for the exception.
- [MethodImpl(InliningOptions.ColdPath)]
public static void ThrowInvalidImageContentException(string errorMessage)
=> throw new InvalidImageContentException(errorMessage);
- ///
- /// Cold path optimization for throwing 's
- ///
- /// The error message for the exception.
- /// The exception that is the cause of the current exception, or a null reference
- /// if no inner exception is specified.
- [MethodImpl(InliningOptions.ColdPath)]
public static void ThrowInvalidImageContentException(string errorMessage, Exception innerException)
=> throw new InvalidImageContentException(errorMessage, innerException);
- ///
- /// Cold path optimization for throwing 's
- ///
- /// The error message for the exception.
- [MethodImpl(InliningOptions.ColdPath)]
public static void ThrowNotSupportedException(string errorMessage)
=> throw new NotSupportedException(errorMessage);
}
diff --git a/src/ImageSharp/Formats/Tiff/TiffThrowHelper.cs b/src/ImageSharp/Formats/Tiff/TiffThrowHelper.cs
index 8c7deecbfb..b2cc638ba0 100644
--- a/src/ImageSharp/Formats/Tiff/TiffThrowHelper.cs
+++ b/src/ImageSharp/Formats/Tiff/TiffThrowHelper.cs
@@ -1,37 +1,21 @@
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
-using System.Runtime.CompilerServices;
-
namespace SixLabors.ImageSharp.Formats.Tiff;
-///
-/// Cold path optimizations for throwing tiff format based exceptions.
-///
internal static class TiffThrowHelper
{
- ///
- /// Cold path optimization for throwing -s
- ///
- /// The error message for the exception.
- [MethodImpl(MethodImplOptions.NoInlining)]
public static Exception ThrowImageFormatException(string errorMessage) => throw new ImageFormatException(errorMessage);
- [MethodImpl(InliningOptions.ColdPath)]
public static Exception NotSupportedDecompressor(string compressionType) => throw new NotSupportedException($"Not supported decoder compression method: {compressionType}");
- [MethodImpl(InliningOptions.ColdPath)]
public static Exception NotSupportedCompressor(string compressionType) => throw new NotSupportedException($"Not supported encoder compression method: {compressionType}");
- [MethodImpl(InliningOptions.ColdPath)]
public static Exception InvalidColorType(string colorType) => throw new NotSupportedException($"Invalid color type: {colorType}");
- [MethodImpl(InliningOptions.ColdPath)]
public static Exception ThrowInvalidHeader() => throw new ImageFormatException("Invalid TIFF file header.");
- [MethodImpl(InliningOptions.ColdPath)]
public static void ThrowNotSupported(string message) => throw new NotSupportedException(message);
- [MethodImpl(InliningOptions.ColdPath)]
public static void ThrowArgumentException(string message) => throw new ArgumentException(message);
}
diff --git a/src/ImageSharp/Formats/Webp/WebpThrowHelper.cs b/src/ImageSharp/Formats/Webp/WebpThrowHelper.cs
index 122580df67..944cefa745 100644
--- a/src/ImageSharp/Formats/Webp/WebpThrowHelper.cs
+++ b/src/ImageSharp/Formats/Webp/WebpThrowHelper.cs
@@ -1,37 +1,15 @@
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
-using System.Runtime.CompilerServices;
-
namespace SixLabors.ImageSharp.Formats.Webp;
internal static class WebpThrowHelper
{
- ///
- /// Cold path optimization for throwing 's.
- ///
- /// The error message for the exception.
- [MethodImpl(InliningOptions.ColdPath)]
public static void ThrowInvalidImageContentException(string errorMessage) => throw new InvalidImageContentException(errorMessage);
- ///
- /// Cold path optimization for throwing -s
- ///
- /// The error message for the exception.
- [MethodImpl(MethodImplOptions.NoInlining)]
public static void ThrowImageFormatException(string errorMessage) => throw new ImageFormatException(errorMessage);
- ///
- /// Cold path optimization for throwing -s
- ///
- /// The error message for the exception.
- [MethodImpl(MethodImplOptions.NoInlining)]
public static void ThrowNotSupportedException(string errorMessage) => throw new NotSupportedException(errorMessage);
- ///
- /// Cold path optimization for throwing -s
- ///
- /// The error message for the exception.
- [MethodImpl(MethodImplOptions.NoInlining)]
public static void ThrowInvalidImageDimensions(string errorMessage) => throw new InvalidImageContentException(errorMessage);
}