{"record":{"id":"91cca869280863ea","repo":"studyzy/imewlconverter","slug":"cnt","errorCode":null,"errorMessage":"词条数量异常: {cnt},可能是文件格式不兼容","messagePattern":"词条数量异常: (.+?),可能是文件格式不兼容","errorType":"exception","errorClass":"InvalidDataException","httpStatus":null,"severity":"error","filePath":"src/ImeWlConverter.Formats/Win10MsSelfStudy/Win10MsPinyinSelfStudyImporter.cs","lineNumber":32,"sourceCode":"    private const int EntrySize = 60;\n\n    protected override IReadOnlyList<WordEntry> ParseBinary(Stream input, CancellationToken ct)\n    {\n        var results = new List<WordEntry>();\n        var fileSize = input.Length;\n\n        if (fileSize < UserWordBase)\n            throw new InvalidDataException(\n                $\"词库文件格式不正确,文件大小至少需要{UserWordBase}字节,当前为{fileSize}字节\");\n\n        // Read word count at offset 12\n        input.Position = 12;\n        var countBytes = new byte[4];\n        input.ReadExactly(countBytes, 0, 4);\n        var cnt = BitConverter.ToInt32(countBytes, 0);\n\n        if (cnt < 0 || cnt > 100000)\n            throw new InvalidDataException($\"词条数量异常: {cnt},可能是文件格式不兼容\");\n\n        for (var i = 0; i < cnt; i++)\n        {\n            ct.ThrowIfCancellationRequested();\n\n            var curIdx = UserWordBase + i * EntrySize;\n\n            if (curIdx + EntrySize > fileSize)\n                break;\n\n            // Read word length at curIdx + 10\n            input.Position = curIdx + 10;\n            var wordLen = input.ReadByte() & 0xFF;\n\n            if (wordLen <= 0 || wordLen > 24)\n                continue;\n\n            // Read word at curIdx + 12","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/studyzy/imewlconverter/blob/16744a12ed5064896cf39095163e44b367aaada1/src/ImeWlConverter.Formats/Win10MsSelfStudy/Win10MsPinyinSelfStudyImporter.cs#L14-L50","documentation":"After the size check passes, the importer reads a 4-byte word count at offset 12. A real self-study file has a sane positive count bounded well under 100000; a negative value or one exceeding 100000 means the bytes at offset 12 are not a real count — the file is corrupt or an incompatible format revision. Aborts with InvalidDataException.","triggerScenarios":"A file that passed the 9216-byte size check but is not actually the self-study format (so offset-12 bytes are garbage); a different Win10/Office IME dictionary variant with a different header layout; byte-level corruption in the header region.","commonSituations":"A differently-versioned Microsoft pinyin dictionary whose header differs; a file that is large enough by coincidence but is another format entirely (e.g. another MS IME dictionary).","solutions":["Confirm the file is specifically the Win10 self-study .dat, not another Microsoft IME dictionary variant.","If the file is the standard Win10 MS Pinyin user dictionary, use the regular win10mspy importer instead.","Re-export the file from a supported IME build."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { var entries = importer.ParseBinary(stream, ct); }\ncatch (InvalidDataException ex) { ReportError($\"incompatible win10mspyss format: {ex.Message}\"); }","preventionTips":["Identify the exact Microsoft IME dictionary variant before importing.","If the file is the standard user dict, use win10mspy instead of win10mspyss.","Re-export from a supported IME build when the count field looks unreasonable."],"tags":["win10","mspy","binary","import","corrupt"],"backgroundTag":null,"analyzedSha":"16744a12ed5064896cf39095163e44b367aaada1","analyzedAt":"2026-08-13T19:53:09.031Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}