Perfare/Il2CppDumper · error · NotSupportedException

ERROR: il2cpp file not supported.

Error message

ERROR: il2cpp file not supported.

What it means

Thrown in Init when the first 4 bytes (magic) of the il2cpp binary do not match any supported format: PE never reaches here (it validates internally), WASM 0x6D736100, NSO 0x304F534E, ELF, etc. are handled, anything else is rejected. The file is not a recognized executable format.

Solutions

  1. Check the first 4 bytes of the binary to identify its actual format.
  2. If the binary is Mach-O (iOS), convert it or use an Il2CppDumper build/fork with Mach-O support.
  3. If a packer overwrote the magic, dump/unwrap the binary from memory first (e.g. via a dumped memory region that restores the original header).
  4. Ensure the first CLI argument is the il2cpp binary itself, not a zip/archive or config file.

Example fix

// before
Il2CppDumper.exe config.json global-metadata.dat // magic is garbage
// after
Il2CppDumper.exe GameAssembly.dll global-metadata.dat
Defensive patterns

Strategy: validation

Validate before calling

byte[] b = File.ReadAllBytes(binaryPath);
uint magic = BitConverter.ToUInt32(b, 0);
bool known = magic == 0x905A4D || magic == 0x464C457F || magic == 0x304F534E || magic == 0x6D736100; // PE/ELF/NSO/WASM

Type guard

static bool IsKnownIl2CppBinary(byte[] b) => b.Length >= 4 && new HashSet<uint>{0x905A4D,0x464C457F,0x304F534E,0x6D736100}.Contains(BitConverter.ToUInt32(b,0));

Try / catch

try { Init(...); }
catch (NotSupportedException ex) when (ex.Message == "ERROR: il2cpp file not supported.") { /* identify format and pick a matching tool */ }

Prevention

When it happens

Trigger: Running Il2CppDumper with a binary whose leading uint32 is not one of the switch cases (0x6D736100 WASM, 0x304F534E NSO, 0x464C457F ELF, 0x905A4D PE path handled earlier, etc.) — e.g. Mach-O, XELF variants, or text/garbage files.

Common situations: Feeding the dumper an iOS Mach-O binary in a build that expects the ELF/PE switch (depends on the switch's full case set), passing a config or archive file as the binary, or encrypted/packed binaries whose magic was overwritten by a protector.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of Perfare/Il2CppDumper@4741d46ba9 (2026-09-11). Data as JSON: /api/errors/733fb23d387e5a00. Report an issue: GitHub.

Appendix: source

Thrown at Il2CppDumper/Program.cs:133

        {
            Console.WriteLine($"usage: {AppDomain.CurrentDomain.FriendlyName} <executable-file> <global-metadata> <output-directory>");
        }

        private static bool Init(string il2cppPath, string metadataPath, out Metadata metadata, out Il2Cpp il2Cpp)
        {
            Console.WriteLine("Initializing metadata...");
            var metadataBytes = File.ReadAllBytes(metadataPath);
            metadata = new Metadata(new MemoryStream(metadataBytes));
            Console.WriteLine($"Metadata Version: {metadata.Version}");

            Console.WriteLine("Initializing il2cpp file...");
            var il2cppBytes = File.ReadAllBytes(il2cppPath);
            var il2cppMagic = BitConverter.ToUInt32(il2cppBytes, 0);
            var il2CppMemory = new MemoryStream(il2cppBytes);
            switch (il2cppMagic)
            {
                default:
                    throw new NotSupportedException("ERROR: il2cpp file not supported.");
                case 0x6D736100:
                    var web = new WebAssembly(il2CppMemory);
                    il2Cpp = web.CreateMemory();
                    break;
                case 0x304F534E:
                    var nso = new NSO(il2CppMemory);
                    il2Cpp = nso.UnCompress();
                    break;
                case 0x905A4D: //PE
                    il2Cpp = new PE(il2CppMemory);
                    break;
                case 0x464c457f: //ELF
                    if (il2cppBytes[4] == 2) //ELF64
                    {
                        il2Cpp = new Elf64(il2CppMemory);
                    }
                    else
                    {

View on GitHub (pinned to 4741d46ba9)