{"record":{"id":"d552e3b0022bbc0b","repo":"unoplatform/uno","slug":"schemacontext","errorCode":null,"errorMessage":"schemaContext","messagePattern":"schemaContext","errorType":"validation","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/SourceGenerators/System.Xaml/System.Xaml/XamlNodeQueue.cs","lineNumber":41,"sourceCode":"using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Reflection;\nusing System.Windows.Markup;\n\nnamespace Uno.Xaml\n{\n\tpublic class XamlNodeQueue\n\t{\n\t\tQueue<XamlNodeLineInfo> queue = new Queue<XamlNodeLineInfo> ();\n\t\tXamlSchemaContext ctx;\n\t\tXamlReader reader;\n\t\tXamlWriter writer;\n\n\t\tpublic XamlNodeQueue (XamlSchemaContext schemaContext)\n\t\t{\n\t\t\tif (schemaContext == null)\n\t\t\t\tthrow new ArgumentNullException (\"schemaContext\");\n\t\t\tthis.ctx = schemaContext;\n\t\t\treader = new XamlNodeQueueReader (this);\n\t\t\twriter = new XamlNodeQueueWriter (this);\n\t\t}\n\t\t\n\t\tinternal IXamlLineInfo LineInfoProvider { get; set; }\n\n\t\tinternal XamlSchemaContext SchemaContext {\n\t\t\tget { return ctx; }\n\t\t}\n\n\t\tpublic int Count {\n\t\t\tget { return queue.Count; }\n\t\t}\n\n\t\tpublic bool IsEmpty {\n\t\t\tget { return queue.Count == 0; }\n\t\t}","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/unoplatform/uno/blob/04183404888ea21b4e5bfa3493e8d5f15e972c3a/src/SourceGenerators/System.Xaml/System.Xaml/XamlNodeQueue.cs#L23-L59","documentation":"Thrown by the XamlNodeQueue constructor when schemaContext is null. XamlNodeQueue is an in-memory FIFO of XAML nodes used to bridge a XamlWriter and a XamlReader; it requires a XamlSchemaContext to give the nodes type identity, so a null context is rejected with ArgumentNullException.","triggerScenarios":"Constructing new XamlNodeQueue(null). This typically happens when code passes a schema context variable that was never initialized or was conditionally set to null.","commonSituations":"XAML writer-to-reader bridging code (e.g. XamlWriter back into XamlReader) where the schema context comes from an optional field or a factory that returned null. Pipeline construction that omits the schema context argument.","solutions":["Pass a valid XamlSchemaContext: new XamlNodeQueue(new XamlSchemaContext()).","Reuse an existing schema context from your reader/writer rather than passing null.","Add a null guard before construction and create a default context if needed."],"exampleFix":"// before\nvar queue = new XamlNodeQueue(schemaContext); // schemaContext is null\n\n// after\nvar queue = new XamlNodeQueue(schemaContext ?? new XamlSchemaContext());","handlingStrategy":"validation","validationCode":"var ctx = schemaContext ?? new XamlSchemaContext();\nvar queue = new XamlNodeQueue(ctx);","typeGuard":null,"tryCatchPattern":"try { var q = new XamlNodeQueue(sctx); }\ncatch (ArgumentNullException) { var q = new XamlNodeQueue(new XamlSchemaContext()); }","preventionTips":["Never pass null for schemaContext to XamlNodeQueue.","Reuse an existing context or create a default one."],"tags":["xaml","argument-null","node-queue","schema-context","uno-xaml"],"backgroundTag":null,"analyzedSha":"04183404888ea21b4e5bfa3493e8d5f15e972c3a","analyzedAt":"2026-08-13T21:08:11.651Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}