{"record":{"id":"266153c835958937","repo":"unoplatform/uno","slug":"xamltypename","errorCode":null,"errorMessage":"xamlTypeName","messagePattern":"xamlTypeName","errorType":"validation","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/SourceGenerators/System.Xaml/System.Xaml/XamlSchemaContext.cs","lineNumber":260,"sourceCode":"\t\t\t\tif (xt == null)\n\t\t\t\t\tforeach (var ns in GetAllXamlNamespaces())\n\t\t\t\t\t\tif ((xt = GetAllXamlTypes(ns).FirstOrDefault(t => t.UnderlyingType == type)) != null)\n\t\t\t\t\t\t\tbreak;\n\t\t\t\tif (xt == null)\n\t\t\t\t{\n\t\t\t\t\txt = new XamlType(type, this);\n\t\t\t\t\trun_time_types.Add(xt);\n\t\t\t\t}\n\t\t\t\treturn xt;\n\t\t\t}\n\t\t}\n\t\t\n\t\tpublic XamlType GetXamlType (XamlTypeName xamlTypeName)\n\t\t{\n\t\t\tlock (gate)\n\t\t\t{\n\t\t\t\tif (xamlTypeName == null)\n\t\t\t\t\tthrow new ArgumentNullException(\"xamlTypeName\");\n\n\t\t\t\tvar n = xamlTypeName;\n\t\t\t\tif (n.TypeArguments.Count == 0) // non-generic\n\t\t\t\t\treturn GetXamlType(n.Namespace, n.Name);\n\n\t\t\t\t// generic\n\t\t\t\tXamlType[] typeArgs = new XamlType[n.TypeArguments.Count];\n\t\t\t\tfor (int i = 0; i < typeArgs.Length; i++)\n\t\t\t\t\ttypeArgs[i] = GetXamlType(n.TypeArguments[i]);\n\t\t\t\treturn GetXamlType(n.Namespace, n.Name, typeArgs);\n\t\t\t}\n\t\t}\n\t\t\n\t\tprotected internal virtual XamlType GetXamlType (string xamlNamespace, string name, params XamlType [] typeArguments)\n\t\t{\n\t\t\tlock (gate)\n\t\t\t{\n\t\t\t\tstring dummy;","sourceCodeStart":242,"sourceCodeEnd":278,"githubUrl":"https://github.com/unoplatform/uno/blob/04183404888ea21b4e5bfa3493e8d5f15e972c3a/src/SourceGenerators/System.Xaml/System.Xaml/XamlSchemaContext.cs#L242-L278","documentation":"Thrown by the XamlTypeName overload of XamlSchemaContext.GetXamlType when xamlTypeName is null. This overload parses a structured XamlTypeName (namespace, name, type arguments) into a XamlType; a null name cannot be parsed, so it fails fast.","triggerScenarios":"Calling `schemaContext.GetXamlType((XamlTypeName)null)` — typically a caller that built a XamlTypeName conditionally and it came back null.","commonSituations":"Name-parsing helpers returning null on malformed input and forwarding it; test scaffolding passing null.","solutions":["Pass a non-null XamlTypeName instance.","Null-check the result of any name-parsing code before calling GetXamlType.","Return a sentinel/early-out in your caller if the parsed name is null."],"exampleFix":"// before\nvar xt = ctx.GetXamlType(parsed); // parsed may be null\n// after\nif (parsed != null)\n    var xt = ctx.GetXamlType(parsed);","handlingStrategy":"validation","validationCode":"if (xamlTypeName == null)\n    throw new InvalidOperationException(\"xamlTypeName must be non-null before calling GetXamlType.\");\nvar xt = ctx.GetXamlType(xamlTypeName);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Null-check the output of any name-parsing code before forwarding to GetXamlType.","Return early from callers when the parsed name is null.","Validate structured names before constructing the writer/schema flow."],"tags":["xaml","null-argument","schema-context","validation"],"backgroundTag":null,"analyzedSha":"04183404888ea21b4e5bfa3493e8d5f15e972c3a","analyzedAt":"2026-08-13T21:08:11.651Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}