{"record":{"id":"ba679b28dbe2730e","repo":"dotnet/wpf","slug":"drawing-attribute-tag-embedded-in-isf-stream-does-not-match","errorCode":null,"errorMessage":"Drawing Attribute tag embedded in ISF stream does not match guid table","messagePattern":"Drawing Attribute tag embedded in ISF stream does not match guid table","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/InkSerializedFormat/DrawingAttributeSerializer.cs","lineNumber":143,"sourceCode":"            {\n                KnownTagCache.KnownTagIndex tag;\n                uint uiTag;\n                // First read the tag\n                uint cb = SerializationHelper.Decode (stream, out uiTag);\n                tag = (KnownTagCache.KnownTagIndex)uiTag;\n\n                if (maximumStreamSize < cb)\n                {\n                    throw new ArgumentException(StrokeCollectionSerializer.ISFDebugMessage(\"ISF size is larger than maximum stream size\"));\n                }\n\n                maximumStreamSize -= cb;\n\n                // Get the guid based on the tag\n                Guid guid = guidList.FindGuid (tag);\n                if (guid == Guid.Empty)\n                {\n                    throw new ArgumentException(StrokeCollectionSerializer.ISFDebugMessage(\"Drawing Attribute tag embedded in ISF stream does not match guid table\"));\n                }\n\n                uint dw = 0;\n\n                if (KnownIds.PenTip == guid)\n                {\n                    cb = SerializationHelper.Decode (stream, out dw);\n                    penTip = (PenTip)dw;\n                    if (!PenTipHelper.IsDefined(penTip))\n                    {\n                        throw new ArgumentException(StrokeCollectionSerializer.ISFDebugMessage(\"Invalid PenTip value found in ISF stream\"));\n                    }\n                    maximumStreamSize -= cb;\n                }\n                else if (KnownIds.PenStyle == guid)\n                {\n                    cb = SerializationHelper.Decode(stream, out dw);\n                    penStyle = (PenStyle)dw;","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/InkSerializedFormat/DrawingAttributeSerializer.cs#L125-L161","documentation":"After decoding a DrawingAttribute tag from ISF, DecodeAsISF looks it up in the guidList via FindGuid. If no guid matches (Guid.Empty), the tag is unknown to this guid table, and the method throws ArgumentException. This means the stream's tag dictionary and the supplied guid list are inconsistent.","triggerScenarios":"Calling DecodeAsISF with a guidList that lacks the mapping for a tag present in the stream — e.g. the wrong GuidList instance, an ISF written with custom guid entries omitted, or cross-version streams.","commonSituations":"Splitting ISF persistence across sessions where the custom-guid table is not persisted alongside the data; sharing ISF between applications with different custom guid registrations; corrupt stream data.","solutions":["Persist and reload the complete guid table (custom guid list) with the ISF data","Pass the same GuidList used when the ISF was encoded","Ensure the ISF producer and consumer use compatible WPF versions","Validate the stream source; regenerate if corrupt"],"exampleFix":"// before\nguidList = new GuidList(); // missing custom guid entries\nDrawingAttributeSerializer.DecodeAsISF(stream, guidList, maxSize);\n// after\nguidList = PersistedGuidList.LoadFrom(metadataSidecar); // restore tags saved with the ISF\nDrawingAttributeSerializer.DecodeAsISF(stream, guidList, maxSize);","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { DrawingAttributeSerializer.DecodeAsISF(stream, guidList, maxSize); }\ncatch (ArgumentException ex) when (ex.Message.Contains(\"guid table\")) { /* reload correct guid table and retry once */ }","preventionTips":["Persist the custom guid table together with the ISF data","Reuse the same GuidList instance for encode and decode","Version your ISF payloads alongside guid registrations","Share custom guid definitions via a common assembly/config"],"tags":["wpf","ink","isf","guid","deserialization"],"backgroundTag":"resource-not-found","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"}