{"record":{"id":"c61baaea52611222","repo":"dotnet/wpf","slug":"unknown-path-operation-attempted","errorCode":null,"errorMessage":"Unknown path operation attempted.","messagePattern":"Unknown path operation attempted\\.","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Media/ParserStreamGeometryContext.cs","lineNumber":715,"sourceCode":"        // PackByte\n        //      Packs an op-code, and up to 4 booleans into a single byte.\n        //\n        // Binary format is :\n        //      First 4 bits map directly to the op-code.\n        //      Next 4 bits map to booleans 1 - 4.\n        //\n        //          Like this:\n        //\n        //              7| 6  | 5  | 4  | 3 | 2 | 1 | 0 |\n        //           <B4>|<B3>|<B2>|<B1><-  Op Code    ->\n        //\n        private static byte PackByte(ParserGeometryContextOpCodes opCode, bool bool1, bool bool2, bool bool3, bool bool4)\n        {\n            byte packedByte = (byte) opCode;\n\n            if (packedByte >= 16)\n            {\n                throw new ArgumentException(SR.UnknownPathOperationType);\n            }\n\n            if (bool1)\n            {\n                packedByte |= SetBool1;\n            }\n\n            if (bool2)\n            {\n                packedByte |= SetBool2;\n            }\n\n            if (bool3)\n            {\n                packedByte |= SetBool3;\n            }\n\n            if (bool4)","sourceCodeStart":697,"sourceCodeEnd":733,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Media/ParserStreamGeometryContext.cs#L697-L733","documentation":"ParserStreamGeometryContext.PackByte throws ArgumentException with 'Unknown path operation attempted.' when a path geometry operation opcode is >= 16 and cannot fit into the packed byte format (the low 4 bits hold the opcode, the high bits hold boolean flags). This is an internal limit of the BAML/path-packing format, so it indicates a corrupted or invalid internal state rather than a caller mistake.","triggerScenarios":"Internal path-parsing/packing code invoking PackByte with an out-of-range ParserGeometryContextOpCodes value; feeding a corrupted BAML/stream geometry stream whose opcode byte decodes to an undefined operation.","commonSituations":"Deserializing BAML produced by an incompatible newer WPF version; corrupted XAML/BAML resources; memory corruption or a bug in custom derivation of the parsing pipeline.","solutions":["Verify the BAML/assembly was compiled with a compatible .NET/WPF version and rebuild resources","Regenerate the corrupted resource or XAML compilation output (clean + rebuild)","If hit in custom parsing code, ensure only defined ParserGeometryContextOpCodes values (< 16) are passed"],"exampleFix":"// before\ncontext.PackByte((ParserGeometryContextOpCodes)unknownOp, ...);\n// after\nif (unknownOp >= ParserGeometryContextOpCodes.OpCodeLimit) throw new InvalidOperationException($\"opcode {unknownOp} unsupported\");\ncontext.PackByte(knownOp, ...);","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { ParsePath(data); } catch (ArgumentException ex) when (ex.Message.Contains(\"Unknown path operation\")) { /* regenerate */ }","preventionTips":["Clean+rebuild resources after framework upgrades","Avoid custom opcode packing code"],"tags":["baml","internal-error","path-geometry"],"backgroundTag":"internal-invariant-violation","analyzedSha":"81131a70a4c573cd62748a5c36908fc4d662daa9","analyzedAt":"2026-09-14T10:12:48.479Z","contentChangedAt":"2026-09-14T10:12:48.479Z","schemaVersion":2},"datasetVersion":"2026-09-21T21:30:21.729Z"}