{"record":{"id":"b1e7886ada208528","repo":"dotnet/wpf","slug":"isf-operation-failed","errorCode":null,"errorMessage":"ISF Operation Failed","messagePattern":"ISF Operation Failed","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/InkSerializedFormat/Compress.cs","lineNumber":158,"sourceCode":"        /// DecompressPropertyData - decompresses a byte[] representing property data (such as DrawingAttributes.Color)\n        /// </summary>\n        /// <param name=\"input\">The byte[] to decompress</param>\n#endif\n        internal static byte[] DecompressPropertyData(byte[] input)\n        {\n#if OLD_ISF\n            //\n            // lock to prevent multi-threaded vulnerabilities \n            //\n            lock (_compressSync)\n            {\n#endif\n                if (input == null)\n                {\n                    //we don't raise any information that could be used to attack our ISF code\n                    //a simple 'ISF Operation Failed' is sufficient since the user can't do \n                    //anything to fix bogus ISF\n                    throw new InvalidOperationException(StrokeCollectionSerializer.ISFDebugMessage(SR.DecompressPropertyFailed));\n                }\n\n                byte[] data = AlgoModule.DecompressPropertyData(input);\n#if OLD_ISF\n                uint size = 0;\n                byte algo = 0;\n                int hr = MS.Win32.Penimc.UnsafeNativeMethods.IsfDecompressPropertyData(input, (uint)input.Length, ref size, null, ref algo);\n                if (0 == hr)\n                {\n                    byte[] data2 = new byte[size];\n                    hr = MS.Win32.Penimc.UnsafeNativeMethods.IsfDecompressPropertyData(input, (uint)input.Length, ref size, data2, ref algo);\n                    if (0 == hr)\n                    {\n\n                        if (data.Length != data2.Length)\n                        {\n                            throw new InvalidOperationException(\"MAGIC EXCEPTION: Property bytes length when decompressed didn't match with new uncompression\");\n                        }","sourceCodeStart":140,"sourceCodeEnd":176,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/InkSerializedFormat/Compress.cs#L140-L176","documentation":"After attempting to decompress an ISF property blob the result was null, meaning property decompression failed; the library throws the generic 'ISF Operation Failed' InvalidOperationException to avoid exposing details of the failure to potential attackers.","triggerScenarios":"Deserializing ISF drawing attributes / custom properties where the compressed property blob is invalid, e.g. bad algorithm byte or truncated payload fed into AlgoModule.DecompressPropertyData.","commonSituations":"Corrupt or hand-modified .isf files; ink metadata copied across incompatible applications; partially downloaded/truncated ink streams.","solutions":["Recover the ink from the original source or re-save it with a working WPF application","Inspect the property blob header byte and length for validity before deserialization","Catch InvalidOperationException around attribute/property deserialization and drop only the affected property"],"exampleFix":"// before\nvar attr = StylusPointPropertyIdsFromIsf(blob); // throws ISF Operation Failed\n// after\ntry { attr = Parse(blob); } catch (InvalidOperationException) { attr = DefaultAttributes; }","handlingStrategy":"try-catch","validationCode":"if (blob == null || blob.Length < 2) return DefaultAttributes;","typeGuard":"bool HasValidPropertyHeader(byte[] b) => b is { Length: >= 2 } && (b[0] & 0x40) == 0;","tryCatchPattern":"try { attr = DecodeAttributes(blob); } catch (InvalidOperationException) { attr = DefaultAttributes; }","preventionTips":["Verify ISF integrity before deserializing attributes","Never modify attribute blobs by hand","Drop individual properties rather than failing the whole document"],"tags":["wpf","ink","isf","deserialization"],"backgroundTag":"unexpected-response-shape","analyzedSha":"81131a70a4c573cd62748a5c36908fc4d662daa9","analyzedAt":"2026-09-14T10:12:48.479Z","contentChangedAt":"2026-09-14T10:12:48.479Z","schemaVersion":2},"datasetVersion":"2026-09-22T01:17:13.364Z"}