{"record":{"id":"520e7218242267e2","repo":"huiyadanli/RevokeMsgPatcher","slug":"error-520e72","errorCode":null,"errorMessage":"查询串与替换串完全相同！请确认补丁信息的正确性。","messagePattern":"查询串与替换串完全相同！请确认补丁信息的正确性。","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"RevokeMsgPatcher.Assistant/FormAssisant.cs","lineNumber":96,"sourceCode":"                else\n                {\n                    if (diff != null)\n                    {\n                        changeOffsets.Last().Content = diff.ToArray();\n                        diff = null;\n                    }\n                }\n            }\n            // 最后一位也是要被替换的情况\n            if (diff != null)\n            {\n                changeOffsets.Last().Content = diff.ToArray();\n                diff = null;\n            }\n\n            if (changeOffsets.Count == 0)\n            {\n                throw new Exception(\"查询串与替换串完全相同！请确认补丁信息的正确性。\");\n            }\n\n            List<Change> changes = new List<Change>();\n            foreach (int index in indexs)\n            {\n                foreach (Change offset in changeOffsets)\n                {\n                    Change c = offset.Clone();\n                    c.Position += index;\n                    changes.Add(c);\n                }\n            }\n            return changes;\n        }\n\n        private void btnGetVersion_Click(object sender, EventArgs e)\n        {\n            string version = FileUtil.GetFileVersion(@\"\");","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/huiyadanli/RevokeMsgPatcher/blob/89cbbb3f0cc896d5d092de0199a635c5c39944b6/RevokeMsgPatcher.Assistant/FormAssisant.cs#L78-L114","documentation":"After the length check, ComputChanges scans byte-by-byte collecting 'changeOffsets' wherever search != replace. If the two arrays are byte-for-byte identical (zero differences), changeOffsets is empty and it throws a plain Exception treating it as a data error, because a no-op patch almost always means the author entered the same string twice by mistake.","triggerScenarios":"Calling ComputChanges with searchBytes and replaceBytes that are identical (changeOffsets.Count == 0). Typically the same hex string was pasted into both the search and replace fields of btnSearch_Click.","commonSituations":"Copy-paste error putting the same signature into both the search and replace text boxes; forgetting to actually author the replacement bytes.","solutions":["Provide a replaceBytes value that actually differs from searchBytes.","Double-check you copied the post-patch bytes (the disassembled/edited target) into the replace field, not the original again.","Validate that at least one byte differs before calling ComputChanges."],"exampleFix":"// before\nbyte[] searchBytes  = ByteUtil.HexStringToByteArray(\"AA BB CC\");\nbyte[] replaceBytes = ByteUtil.HexStringToByteArray(\"AA BB CC\"); // identical -> throws\n\n// after\nbyte[] replaceBytes = ByteUtil.HexStringToByteArray(\"AA BB 99\"); // differs at index 2","handlingStrategy":"validation","validationCode":"bool anyDiff = false;\nfor (int i = 0; i < searchBytes.Length; i++)\n{\n    if (searchBytes[i] != replaceBytes[i]) { anyDiff = true; break; }\n}\nif (!anyDiff)\n{\n    txtInfo.AppendText(\"查询串与替换串完全相同，请确认补丁信息。\" + Environment.NewLine);\n    return;\n}\nList<Change> changes = ComputChanges(indexs, searchBytes, replaceBytes);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When authoring, always confirm the replace bytes are the actual post-patch bytes, not a duplicate of the search.","Run a quick diff check in the Assistant UI before generating patch data."],"tags":["authoring","data-validation","assistant"],"backgroundTag":null,"analyzedSha":"89cbbb3f0cc896d5d092de0199a635c5c39944b6","analyzedAt":"2026-08-13T10:37:37.073Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}