stride3d/stride · error · InvalidOperationException
Unexpected ArraySize == 0 from DDS HeaderDX10
Error message
Unexpected ArraySize == 0 from DDS HeaderDX10
What it means
A DDS file with an extended DX10 header declares texture arrays via ArraySize. Stride (following DirectXTex) treats ArraySize == 0 as invalid — a resource must have at least one array element — so DecodeDDSHeader throws InvalidOperationException.
Solutions
- Fix or regenerate the DDS file with ArraySize >= 1 using a reliable tool (texconv, image studio)
- Inspect the file's DX10 header bytes (offset 128+20) to confirm the bad ArraySize
- Convert the texture to a format without a DX10 header (plain DX9-style DDS) as a workaround
- Patch ArraySize to 1 in the file if you know the texture is a single image
Example fix
// before (DDS DX10 header, 4-byte DWORD at offset 128+20) ArraySize = 0 // after ArraySize = 1
Defensive patterns
Strategy: validation
Validate before calling
// Check DX10 header ArraySize before decoding (after magic+DX9 header at offset 128)
int dx10Offset = 128 + 20;
if (hasDx10Header && BitConverter.ToUInt32(ddsBytes, dx10Offset) == 0)
throw new InvalidOperationException("DDS DX10 header has ArraySize == 0; file is malformed"); Try / catch
try { image = Image.Load(ddsBytes); } catch (InvalidOperationException ex) when (ex.Message.Contains("ArraySize == 0")) { // treat as corrupt asset
log.Error("Corrupt DDS (ArraySize=0); regenerate with texconv"); throw; } Prevention
- Validate DDS assets at import time in the content pipeline
- Standardize on mainstream tools (texconv) for DDS generation
- Add a pre-commit asset lint that checks DX10 header fields
- Hash-and-version control source textures to detect corruption
When it happens
Trigger: Loading a DDS file whose HeaderDXT10.ArraySize field is 0, produced by a tool/bad writer or corrupted file.
Common situations: DDS files written by buggy custom exporters, files corrupted in transit, older/incorrect tools writing DX10 headers incorrectly.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- Unexpected Height != 1 from DDS HeaderDX10
- Texture3D missing HeaderFlags.Volume from DDS HeaderDX10
- Unexpected ArraySize > 1 for Texture3D from DDS HeaderDX10
- Pointer to DDS header cannot be null
- Invalid Format from DDS HeaderDX10
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/01487b795645dca3.
Report an issue: GitHub.
Appendix: source
Thrown at sources/engine/Stride.Foundation/Graphics/DDSHelper.cs:331
// Setup MipLevels
description.MipLevels = header.MipMapCount;
if (description.MipLevels == 0)
description.MipLevels = 1;
// Check for DX10 extension
if ((header.PixelFormat.Flags & DDS.PixelFormatFlags.FourCC) != 0 && (new FourCC('D', 'X', '1', '0') == header.PixelFormat.FourCC))
{
// Buffer must be big enough for both headers and magic value
if (size < (Unsafe.SizeOf<DDS.Header>() + sizeof (uint) + Unsafe.SizeOf<DDS.HeaderDXT10>()))
return false;
var headerDX10 = *(DDS.HeaderDXT10*) ((byte*) headerPtr + sizeof (int) + Unsafe.SizeOf<DDS.Header>());
convFlags |= ConversionFlags.DX10;
description.ArraySize = headerDX10.ArraySize;
if (description.ArraySize == 0)
throw new InvalidOperationException("Unexpected ArraySize == 0 from DDS HeaderDX10 ");
description.Format = headerDX10.DXGIFormat;
if (!description.Format.IsValid)
throw new InvalidOperationException("Invalid Format from DDS HeaderDX10 ");
switch (headerDX10.ResourceDimension)
{
case DDS.ResourceDimension.Texture1D:
// D3DX writes 1D textures with a fixed Height of 1
if ((header.Flags & DDS.HeaderFlags.Height) != 0 && header.Height != 1)
throw new InvalidOperationException("Unexpected Height != 1 from DDS HeaderDX10 ");
description.Width = header.Width;
description.Height = 1;
description.Depth = 1;
description.Dimension = TextureDimension.Texture1D;
break;View on GitHub (pinned to 96fad776d2)