QL-Win/QuickLook · error · InvalidDataException
The file is too small to be a minidump.
Error message
The file is too small to be a minidump.
What it means
Thrown by MinidumpReader.ReadHeader when fileLength is less than HeaderSize (32 bytes). A valid Windows minidump must contain at least the 32-byte MINIDUMP_HEADER, so anything smaller cannot be a minidump. This is an InvalidDataException raised before any field is read.
Source
Thrown at QuickLook.Plugin/QuickLook.Plugin.DumpViewer/MinidumpReader.cs:97
ReadClrVersions(info);
}
catch (Exception ex)
{
info.ParseError = ex.Message;
}
return info;
}
private static FileStream OpenRead(string path)
{
return new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite | FileShare.Delete);
}
private static MinidumpHeader ReadHeader(BinaryReader reader, long fileLength)
{
if (fileLength < HeaderSize)
throw new InvalidDataException("The file is too small to be a minidump.");
reader.BaseStream.Position = 0;
var header = new MinidumpHeader
{
Signature = reader.ReadUInt32(),
Version = reader.ReadUInt32(),
NumberOfStreams = reader.ReadUInt32(),
StreamDirectoryRva = reader.ReadUInt32(),
CheckSum = reader.ReadUInt32(),
TimeDateStamp = reader.ReadUInt32(),
Flags = reader.ReadUInt64(),
};
if (header.Signature != MinidumpSignature)
throw new InvalidDataException("The file does not have a minidump signature.");
var directoryBytes = (long)header.NumberOfStreams * DirectoryEntrySize;View on GitHub (pinned to cb5d9c429c)
Solutions
- Pre-screen with MinidumpReader.IsMinidump(path) which returns false (never throws) for short files before calling Read.
- Check File.Exists and new FileInfo(path).Length >= 32 before opening.
- If the file is expected to be a dump, re-capture it from the crashing process; an undersized dump means the writer was interrupted.
- Catch InvalidDataException at the plugin boundary and show 'not a minidump' rather than crashing the preview.
Example fix
// before using var reader = new BinaryReader(OpenRead(path)); var header = ReadHeader(reader, stream.Length); // after if (stream.Length < 32) return null; // or IsMinidump(path) guard var header = ReadHeader(reader, stream.Length);
Defensive patterns
Strategy: validation
Validate before calling
if (!File.Exists(path) || new FileInfo(path).Length < 32) return; // too small to be a minidump // or use the built-in safe probe: if (!MinidumpReader.IsMinidump(path)) return;
Type guard
static bool CouldBeMinidump(long len) => len >= 32;
Try / catch
try { var info = MinidumpReader.Read(path); }
catch (InvalidDataException ex) when (ex.Message.Contains("too small")) { /* show 'not a minidump' */ } Prevention
- Always call MinidumpReader.IsMinidump(path) before Read — it never throws.
- Gate the plugin on a minimum file size of 32 bytes.
- Verify dump writers complete before the target file is opened.
When it happens
Trigger: Calling MinidumpReader.Read (or ReadHeader) on a file whose Length < 32. Common with empty placeholder files, a 0-byte download, or a file of a different type whose path/extension was assumed to be a .dmp.
Common situations: Previewing a path that QuickLook routed to DumpViewer but the file is empty or only a few bytes; an aborted crash-dump write; a symlink/placeholder; a non-dump file passed because only extension matching was done.
Related errors
- The file does not have a minidump signature.
- The minidump stream directory is outside the file.
- DOS signature not found.
- Thumbs.db not found.
- DS_Store: unknown record type '{stype}'
AI-assisted analysis of QL-Win/QuickLook@cb5d9c429c (2026-08-13).
Data as JSON: /api/errors/a892cd3a1c72c3e1.
Report an issue: GitHub.