{"record":{"id":"ca3a12dda101fb47","repo":"dotnet/wpf","slug":"invaliddatainisf","errorCode":null,"errorMessage":"InvalidDataInISF","messagePattern":"InvalidDataInISF","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/InkSerializedFormat/CustomAttributeSerializer.cs","lineNumber":949,"sourceCode":"                                                break;\n                                            }\n                                            case (VarEnum.VT_DATE)://7\n                                            {\n                                                DateTime data = (DateTime)value;\n                                                writer.Write(data.ToOADate());\n                                                break;\n                                            }\n                                            default:\n                                            {\n                                                Debug.Fail(\"Missing case statement!\");\n                                                break;\n                                            }\n                                        }\n                                    }\n                                    catch (ArgumentException ex)\n                                    {\n                                        //catches bad char & char[]\n                                        throw new ArgumentException(SR.InvalidDataInISF, ex);\n                                    }\n                                    catch (OverflowException ex)\n                                    {\n                                        //catches bad DateTime\n                                        throw new ArgumentException(SR.InvalidDataInISF, ex);\n                                    }\n                                }\n                            }\n                            break;\n                        }\n                        //do nothing in the default case...\n                    }\n                }\n                return;\n            }\n        }\n        #endregion // Key/Value pair validation helpers\n","sourceCodeStart":931,"sourceCodeEnd":967,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/InkSerializedFormat/CustomAttributeSerializer.cs#L931-L967","documentation":"While decoding extended properties from an ISF stream, converting the persisted bytes back to a char or char[] threw ArgumentException (bad character data), so the serializer wraps it in a new ArgumentException with SR.InvalidDataInISF. This indicates the ISF payload is corrupt or was not produced with matching type metadata. The original exception is preserved as InnerException.","triggerScenarios":"Reading a stroke's ExtendedProperties from ISF whose declared type is char/char[] but the byte payload is not a valid UTF-16 char sequence — e.g. odd byte counts, truncated data, or data written by a non-WPF producer.","commonSituations":"Hand-edited or third-party-generated ISF; files truncated in transfer; cross-version/cross-platform ISF interchange where the extended property type table disagrees with the payload.","solutions":["Validate the ISF source file/stream integrity before loading","Remove or re-save the offending ExtendedProperty before serializing the ink again","Inspect ex.InnerException for the underlying decode failure","Regenerate the ISF from the original ink data if available"],"exampleFix":"// before\nstrokeCollection = new StrokeCollectionReader(isfStream).GetStrokeCollection(); // throws on corrupt data\n// after\ntry\n{\n    strokeCollection = new StrokeCollectionReader(isfStream).GetStrokeCollection();\n}\ncatch (ArgumentException ex) when (ex.InnerException != null)\n{\n    // log ex.InnerException; fall back to re-saving or skipping the bad stroke\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { strokes = new StrokeCollection(isfStream); }\ncatch (ArgumentException ex) when (ex.Message.Contains(\"ISF\")) { Log(ex.InnerException); isfStream.Seek(0, SeekOrigin.Begin); /* salvage path */ }","preventionTips":["Checksum ISF files at write time and verify before load","Never hand-edit ISF bytes","Test round-trip serialization of char/char[] extended properties","Validate third-party ISF in a sandboxed load before production use"],"tags":["wpf","ink","isf","corrupt-data","deserialization"],"backgroundTag":"invalid-argument-format","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"}