SixLabors/ImageSharp · error · NotSupportedException

Data type is not supported.

Error message

Data type {dataType} is not supported.

What it means

ExifReader.ConvertValue switches on the EXIF data type read from an IFD entry; if the type code is outside the set ImageSharp knows (including the BigTIFF 64-bit variants it handles), it throws NotSupportedException. This indicates an unrecognized/unsupported EXIF type code in the file.

Solutions

  1. Check whether the failing file's EXIF is nonstandard; strip or normalize EXIF metadata with exiftool/ImageMagick before processing.
  2. Catch NotSupportedException around metadata load if unsupported metadata is nonessential to your workflow.
  3. Report the type code upstream / upgrade ImageSharp in case support was added for that type.

Example fix

// before
using var image = Image.Load(path); // throws on unsupported EXIF type
// after
try
{
    using var image = Image.Load(path);
}
catch (NotSupportedException ex)
{
    logger.LogWarning("Unsupported EXIF data type in {Path}: {Msg}", path, ex.Message);
    // proceed without metadata or use a fallback loader
}
Defensive patterns

Strategy: try-catch

Try / catch

try { using var image = Image.Load(path); }
catch (NotSupportedException ex) when (ex.Message.Contains("Data type"))
{ /* strip EXIF with exiftool and retry, or proceed without metadata */ }

Prevention

When it happens

Trigger: Reading an EXIF/TIFF directory entry whose type field contains an unsupported data type code — usually because the file uses vendor-specific or newer-spec types ImageSharp doesn't implement, or the entry's type bytes are corrupt.

Common situations: Decoding images with non-standard EXIF written by exotic tools or cameras; corrupt files where type codes were overwritten; files mixing EXIF flavors the library doesn't fully support.

Related errors


AI-assisted analysis of SixLabors/ImageSharp@59ce6af6fc (2026-09-13). Data as JSON: /api/errors/710ec96a0d39ab73. Report an issue: GitHub.

Appendix: source

Thrown at src/ImageSharp/Metadata/Profiles/Exif/ExifReader.cs:384

                return ToArray(dataType, buffer, this.ConvertToSingle);
            case ExifDataType.Long8:
            case ExifDataType.Ifd8:
                if (!isArray)
                {
                    return this.ConvertToUInt64(buffer);
                }

                return ToArray(dataType, buffer, this.ConvertToUInt64);
            case ExifDataType.SignedLong8:
                if (!isArray)
                {
                    return this.ConvertToInt64(buffer);
                }

                return ToArray(dataType, buffer, this.ConvertToUInt64);

            default:
                throw new NotSupportedException($"Data type {dataType} is not supported.");
        }
    }

    private void ReadValue(List<IExifValue> values, Span<byte> offsetBuffer)
    {
        // 2   | 2    | 4     | 4
        // tag | type | count | value offset
        if ((this.data.Length - this.data.Position) < 12)
        {
            return;
        }

        ExifTagValue tag = (ExifTagValue)this.ReadUInt16();
        ExifDataType dataType = EnumUtils.Parse(this.ReadUInt16(), ExifDataType.Unknown);

        uint numberOfComponents = this.ReadUInt32();

        this.TryReadSpan(offsetBuffer);

View on GitHub (pinned to 59ce6af6fc)