{"record":{"id":"092ecb92c2dfbfce","repo":"dotnet/wpf","slug":"sr-parserattributeargslow-with-xmlnscompatiblewithattribute","errorCode":null,"errorMessage":"SR.ParserAttributeArgsLow with 'XmlnsCompatibleWithAttribute' (missing XmlnsCompatibleWithAttribute constructor arguments)","messagePattern":"SR\\.ParserAttributeArgsLow with 'XmlnsCompatibleWithAttribute' \\(missing XmlnsCompatibleWithAttribute constructor arguments\\)","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/XmlnsCache.cs","lineNumber":387,"sourceCode":"            {\n#if PBTCOMPILER\n                CustomAttributeData[] attributes = GetAttributes(asmList[asmIdx],\n                                                \"System.Windows.Markup.XmlnsCompatibleWithAttribute\");\n#else\n                Attribute[] attributes = GetAttributes(asmList[asmIdx],\n                                                typeof(XmlnsCompatibleWithAttribute));\n#endif\n\n                for(int attrIdx=0; attrIdx<attributes.Length; attrIdx++)\n                {\n                    string oldXmlns = null;\n                    string newXmlns = null;\n\n                    GetNamespacesFromCompatAttr(attributes[attrIdx], out oldXmlns, out newXmlns);\n\n                    if (String.IsNullOrEmpty(oldXmlns) || String.IsNullOrEmpty(newXmlns))\n                    {\n                        throw new ArgumentException(SR.Format(SR.ParserAttributeArgsLow, \"XmlnsCompatibleWithAttribute\"));\n                    }\n\n                    if (_compatTable.ContainsKey(oldXmlns) &&\n                        _compatTable[oldXmlns] != newXmlns)\n                    {\n                        throw new InvalidOperationException(SR.Format(SR.ParserCompatDuplicate, oldXmlns,\n                                                                   _compatTable[oldXmlns]));\n                    }\n                    _compatTable[oldXmlns] = newXmlns;\n                    _compatTableReverse[newXmlns] = oldXmlns;\n                }\n            }\n        }\n\n        // Table where Xml namespace is the key, and value is a list of assembly / clrns pairs\n        private HybridDictionary _cacheTable = null;\n\n        // Table where old namespaces are the key, and new namespaces are the value","sourceCodeStart":369,"sourceCodeEnd":405,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/XmlnsCache.cs#L369-L405","documentation":"XmlnsCache throws ArgumentException when an [XmlnsCompatibleWithAttribute] found in a scanned assembly yields an empty OldNamespace or NewNamespace. The attribute requires both constructor arguments to be non-empty namespace strings, so a malformed usage in a referenced assembly makes the WPF XAML markup cache unable to build a valid compatibility mapping.","triggerScenarios":"Calling AddReferencedAssemblies or GetMappingArray while scanning an assembly whose [assembly: XmlnsCompatibleWith(...)] attribute was declared with null/empty string arguments (e.g. XmlnsCompatibleWith(\"\", \"newNs\") or omitted constructor args).","commonSituations":"Hand-edited AssemblyInfo.cs, misapplied attribute via reflection-emitted assemblies, or a third-party WPF assembly with a corrupt/incorrect XmlnsCompatibleWithAttribute declaration discovered when the XAML designer or markup compiler builds the xmlns compatibility table.","solutions":["Open the referenced assembly's source and provide both non-empty arguments to XmlnsCompatibleWithAttribute: [assembly: XmlnsCompatibleWith(\"old-clr-ns\", \"new-clr-ns\")]","Identify the offending assembly by scanning referenced assemblies for XmlnsCompatibleWithAttribute usage and inspecting its OldNamespace/NewNamespace values","Remove the invalid XmlnsCompatibleWithAttribute entirely if the namespace compatibility mapping is not needed","Rebuild/reinstall the third-party assembly from a correct source version"],"exampleFix":"// before (AssemblyInfo.cs of referenced assembly)\n[assembly: XmlnsCompatibleWith(\"\")] // missing args\n\n// after\n[assembly: XmlnsCompatibleWith(\"clr-namespace:Old.Ns\", \"clr-namespace:New.Ns\")]","handlingStrategy":"validation","validationCode":"var attr = asm.GetCustomAttribute<XmlnsCompatibleWithAttribute>();\nif (attr != null && (string.IsNullOrEmpty(attr.OldNamespace) || string.IsNullOrEmpty(attr.NewNamespace)))\n    throw new InvalidOperationException($\"Assembly {asm.GetName().Name} has an XmlnsCompatibleWithAttribute with empty namespace arguments.\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always supply both constructor arguments to XmlnsCompatibleWithAttribute","Keep namespace strings in named constants to avoid accidental empty literals","Audit AssemblyInfo files after refactors that rename namespaces"],"tags":["wpf","xaml","markup-compiler","attribute-arguments"],"backgroundTag":"missing-required-argument","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"}