dotnet/wpf · error · ArgumentException

Drawing Attribute tag embedded in ISF stream does not match…

Error message

Drawing Attribute tag embedded in ISF stream does not match guid table

What it means

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.

Solutions

  1. Persist and reload the complete guid table (custom guid list) with the ISF data
  2. Pass the same GuidList used when the ISF was encoded
  3. Ensure the ISF producer and consumer use compatible WPF versions
  4. Validate the stream source; regenerate if corrupt

Example fix

// before
guidList = new GuidList(); // missing custom guid entries
DrawingAttributeSerializer.DecodeAsISF(stream, guidList, maxSize);
// after
guidList = PersistedGuidList.LoadFrom(metadataSidecar); // restore tags saved with the ISF
DrawingAttributeSerializer.DecodeAsISF(stream, guidList, maxSize);
Defensive patterns

Strategy: try-catch

Try / catch

try { DrawingAttributeSerializer.DecodeAsISF(stream, guidList, maxSize); }
catch (ArgumentException ex) when (ex.Message.Contains("guid table")) { /* reload correct guid table and retry once */ }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of dotnet/wpf@81131a70a4 (2026-09-14). Data as JSON: /api/errors/ba679b28dbe2730e. Report an issue: GitHub.

Appendix: source

Thrown at src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/InkSerializedFormat/DrawingAttributeSerializer.cs:143

            {
                KnownTagCache.KnownTagIndex tag;
                uint uiTag;
                // First read the tag
                uint cb = SerializationHelper.Decode (stream, out uiTag);
                tag = (KnownTagCache.KnownTagIndex)uiTag;

                if (maximumStreamSize < cb)
                {
                    throw new ArgumentException(StrokeCollectionSerializer.ISFDebugMessage("ISF size is larger than maximum stream size"));
                }

                maximumStreamSize -= cb;

                // Get the guid based on the tag
                Guid guid = guidList.FindGuid (tag);
                if (guid == Guid.Empty)
                {
                    throw new ArgumentException(StrokeCollectionSerializer.ISFDebugMessage("Drawing Attribute tag embedded in ISF stream does not match guid table"));
                }

                uint dw = 0;

                if (KnownIds.PenTip == guid)
                {
                    cb = SerializationHelper.Decode (stream, out dw);
                    penTip = (PenTip)dw;
                    if (!PenTipHelper.IsDefined(penTip))
                    {
                        throw new ArgumentException(StrokeCollectionSerializer.ISFDebugMessage("Invalid PenTip value found in ISF stream"));
                    }
                    maximumStreamSize -= cb;
                }
                else if (KnownIds.PenStyle == guid)
                {
                    cb = SerializationHelper.Decode(stream, out dw);
                    penStyle = (PenStyle)dw;

View on GitHub (pinned to 81131a70a4)