{"record":{"id":"597e0f6915fb70d3","repo":"dotnet/wpf","slug":"assembly","errorCode":null,"errorMessage":"assembly","messagePattern":"assembly","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/Baml2006/Baml2006Reader.cs","lineNumber":2089,"sourceCode":"                    {\n                        // We need to append local assembly\n\n                        return uriInput + ((_settings.LocalAssembly != null)\n                                                ? $\";assembly={GetAssemblyNameForNamespace(_settings.LocalAssembly)}\"\n                                                : String.Empty);\n                    }\n                    else\n                    {\n                        int assemblyKeywordStartIdx = semicolonIdx + 1;\n                        int equalIdx = uriInput.IndexOf('=');\n                        if (-1 == equalIdx)\n                        {\n                            throw new ArgumentException(SR.Format(SR.MissingTagInNamespace, \"=\", uriInput));\n                        }\n                        ReadOnlySpan<char> keyword = uriInput.AsSpan(assemblyKeywordStartIdx, equalIdx - assemblyKeywordStartIdx);\n                        if (!keyword.Equals(\"assembly\", StringComparison.Ordinal))\n                        {\n                            throw new ArgumentException(SR.Format(SR.AssemblyTagMissing, \"assembly\", uriInput));\n                        }\n                        ReadOnlySpan<char> assemblyName = uriInput.AsSpan(equalIdx + 1);\n                        if (assemblyName.TrimStart().IsEmpty)\n                        {\n                            return string.Concat(uriInput, GetAssemblyNameForNamespace(_settings.LocalAssembly));\n                        }\n                    }\n                }\n            }\n\n            return uriInput;\n        }\n\n        // Providing the assembly short name may lead to ambiguity between two versions of the same assembly, but we need to\n        // keep it this way since it is exposed publicly via the Namespace property, Baml2006ReaderInternal provides the full Assembly name.\n        internal virtual ReadOnlySpan<char> GetAssemblyNameForNamespace(Assembly assembly)\n        {\n            return ReflectionUtils.GetAssemblyPartialName(assembly);","sourceCodeStart":2071,"sourceCodeEnd":2107,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/Baml2006/Baml2006Reader.cs#L2071-L2107","documentation":"When expanding a clr-namespace URI, Baml2006Reader parses the 'assembly=' keyword from the URI string; if the keyword before '=' is not exactly 'assembly' it throws ArgumentException wrapping SR.AssemblyTagMissing. The URI's namespace-to-assembly directive is malformed.","triggerScenarios":"Logic_GetFullXmlns is given a URI like 'clr-namespace:Foo;assemly=App' (misspelled or otherwise not the ordinal string \"assembly\" between the ';' and '=').","commonSituations":"Typo in XAML xmlns declarations (e.g. 'assemblies=', 'asm='); copy-pasted URI fragments; tooling that builds clr-namespace URIs programmatically with a wrong keyword.","solutions":["Fix the URI to use the exact keyword 'assembly' before '=' in the clr-namespace mapping.","Validate the full form: clr-namespace:<Namespace>[;assembly=<AssemblyName>].","Check for typos or locale/renaming refactors that altered the keyword in .xaml files.","If generating URIs in code/tests, build them with a helper that inserts \";assembly=\" verbatim."],"exampleFix":"// before\nxmlns:local=\"clr-namespace:App.Controls;assemly=App\"\n// after\nxmlns:local=\"clr-namespace:App.Controls;assembly=App\"","handlingStrategy":"validation","validationCode":"// Validate clr-namespace URI grammar before handing it to the reader\nbool IsValidClrNamespaceUri(string uri) =>\n    !uri.StartsWith(\"clr-namespace:\") ||\n    uri.Split(';').Skip(1).All(p => !p.Contains('=') || p.Split('=')[0].Trim() == \"assembly\");","typeGuard":null,"tryCatchPattern":"try\n{\n    // resolve namespace URI via reader/schema context\n}\ncatch (ArgumentException ex) when (ex.Message.Contains(\"assembly\"))\n{\n    throw new FormatException($\"clr-namespace URI must use 'assembly=' keyword: {uriInput}\", ex);\n}","preventionTips":["Spell-check xmlns URIs; the only valid keyword is 'assembly'","Use a shared helper to build clr-namespace strings","Add XAML compile (markup compiler) checks in CI to catch typos early","Copy URIs from working samples, not by hand"],"tags":["wpf","xaml","clr-namespace","uri"],"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"}