{"record":{"id":"4e89862107cad0af","repo":"dotnet/wpf","slug":"sr-missingcomma1-sr-missingcomma2-built-into-error","errorCode":null,"errorMessage":"SR.MissingComma1 / SR.MissingComma2 (built into 'error')","messagePattern":"SR\\.MissingComma1 / SR\\.MissingComma2 \\(built into 'error'\\)","errorType":"exception","errorClass":"XamlParseException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Parser/MePullParser.cs","lineNumber":471,"sourceCode":"                        yield return node;\n                    }\n\n                    f.found = f2.found;\n                    break;\n\n                case MeTokenType.PropertyName:\n                    {\n                        string error;\n                        if (_context.CurrentMember is null)\n                        {\n                            error = SR.Format(SR.MissingComma1,  _tokenizer.TokenText);\n                        }\n                        else\n                        {\n                            error = SR.Format(SR.MissingComma2, _context.CurrentMember.Name, _tokenizer.TokenText);\n                        }\n\n                        throw new XamlParseException(_tokenizer, error);\n                    }\n\n                default:\n                    SetBrokenRuleString(\"NamedArg ::= PROPERTYNAME '=' @(STRING | QUOTEDMARKUPEXTENSION | MarkupExtension)\");\n                    break;\n                }\n\n                yield return Logic_EndMember();\n            }\n        }\n\n        // ================================================\n\n        private void NextToken()\n        {\n            _tokenizer.Read();\n        }\n","sourceCodeStart":453,"sourceCodeEnd":489,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Parser/MePullParser.cs#L453-L489","documentation":"In P_NamedArg, a positional or named argument sequence must be comma-separated. When the scanner's current token isn't the expected ',' the parser builds an error via SR.MissingComma1 (after a positional arg) or SR.MissingComma2 (with the current member name and offending token text) and throws XamlParseException.","triggerScenarios":"Markup-extension argument lists missing a comma between arguments, e.g. '{StaticResource Foo Bar}' or '{Binding Path=Text ElementName=Btn}' where 'ElementName' needs a preceding comma.","commonSituations":"Hand-written markup extensions forgetting comma separators, copying positional-style arguments into named-argument form, typos deleting the comma.","solutions":["Insert the missing comma between arguments","Use '=' and ',' correctly for named arguments: Path=Text, ElementName=Btn","Check the member/token named in the error message to find the exact split point"],"exampleFix":"// before\n<TextBlock Text=\"{Binding Path=Name ElementName=Btn}\"/>\n// after\n<TextBlock Text=\"{Binding Path=Name, ElementName=Btn}\"/>","handlingStrategy":"validation","validationCode":"bool ArgumentsCommaSeparated(string s)\n{\n    // crude pre-check: tokens between '=' assignments must start with ','\n    int i = 0;\n    while ((i = s.IndexOf('=', i + 1)) > 0)\n    {\n        int next = s.IndexOf(\"=\", i + 1);\n        int comma = s.IndexOf(',', i);\n        if (next > 0 && (comma < 0 || comma > next)) return false;\n    }\n    return true;\n}","typeGuard":null,"tryCatchPattern":"try { nodes = parser.Parse(meString); }\ncatch (XamlParseException ex) when (ex.Message.Contains(\"comma\") || ex.Message.Contains(\"','\")) { /* point user to the member named in the message */ }","preventionTips":["Separate named arguments with ', Name=Value'","Validate argument syntax in editors/snippets","Copy from working examples rather than retyping"],"tags":["xaml","markup-extension","syntax-error","missing-comma"],"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"}