{"record":{"id":"0d6fda3e42bdef1e","repo":"unoplatform/uno","slug":"unknowntypenamespace","errorCode":null,"errorMessage":"unknownTypeNamespace","messagePattern":"unknownTypeNamespace","errorType":"validation","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/SourceGenerators/System.Xaml/System.Xaml/XamlType.cs","lineNumber":87,"sourceCode":"\t\t\t} else if ((xt = XamlLanguage.AllTypes.FirstOrDefault (t => t.UnderlyingType == type)) != null) {\n\t\t\t\tName = xt.Name;\n\t\t\t\tPreferredXamlNamespace = XamlLanguage.Xaml2006Namespace;\n\t\t\t} else {\n\t\t\t\tName = GetXamlName (type);\n\t\t\t\tPreferredXamlNamespace = schemaContext.GetXamlNamespace (type.Namespace) ?? String.Format (CultureInfo.InvariantCulture, \"clr-namespace:{0};assembly={1}\", type.Namespace, type.Assembly.GetName ().Name);\n\t\t\t}\n\t\t\tif (type.IsGenericType) {\n\t\t\t\tTypeArguments = new List<XamlType> ();\n\t\t\t\tforeach (var gta in type.GetGenericArguments ())\n\t\t\t\t\tTypeArguments.Add (schemaContext.GetXamlType (gta));\n\t\t\t}\n\t\t}\n\n\t\tpublic XamlType (string unknownTypeNamespace, string unknownTypeName, IList<XamlType> typeArguments, XamlSchemaContext schemaContext)\n\t\t\t: this (schemaContext, null)\n\t\t{\n\t\t\tif (unknownTypeNamespace == null)\n\t\t\t\tthrow new ArgumentNullException (\"unknownTypeNamespace\");\n\t\t\tif (unknownTypeName == null)\n\t\t\t\tthrow new ArgumentNullException (\"unknownTypeName\");\n\t\t\tif (schemaContext == null)\n\t\t\t\tthrow new ArgumentNullException (\"schemaContext\");\n\n\t\t\ttype = typeof (object);\n\t\t\tName = unknownTypeName;\n\t\t\tPreferredXamlNamespace = unknownTypeNamespace;\n\t\t\tTypeArguments = typeArguments != null && typeArguments.Count == 0 ? null : typeArguments;\n//\t\t\texplicit_ns = unknownTypeNamespace;\n\t\t}\n\n\t\tprotected XamlType (string typeName, IList<XamlType> typeArguments, XamlSchemaContext schemaContext)\n\t\t\t: this (String.Empty, typeName, typeArguments, schemaContext)\n\t\t{\n\t\t}\n\n\t\tXamlType (XamlSchemaContext schemaContext, XamlTypeInvoker invoker)","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/unoplatform/uno/blob/04183404888ea21b4e5bfa3493e8d5f15e972c3a/src/SourceGenerators/System.Xaml/System.Xaml/XamlType.cs#L69-L105","documentation":"The XamlType(string unknownTypeNamespace, string unknownTypeName, ...) constructor throws ArgumentNullException('unknownTypeNamespace') when the namespace argument is null. This overload represents a type that cannot be resolved at parse time (an 'unknown' XamlType), but it still requires a non-null namespace string to populate PreferredXamlNamespace.","triggerScenarios":"Building an unknown XamlType for a forward-declared type whose XML namespace was not supplied, or passing a namespace variable that resolved to null during XAML parsing.","commonSituations":"XAML parsers constructing placeholder types for unresolved xmlns; tooling that synthesizes XamlType instances from incomplete metadata; tests omitting the namespace argument.","solutions":["Pass a non-null namespace string (use string.Empty if the type has no explicit namespace, matching the protected XamlType overload).","Validate the namespace is non-null at the source that produces it before constructing the unknown XamlType.","If the namespace is genuinely unavailable, surface a parse error to the user rather than constructing an unknown type with null."],"exampleFix":"// before\nvar xt = new XamlType(null, typeName, typeArgs, sctx);\n\n// after\nvar xt = new XamlType(namespace ?? string.Empty, typeName, typeArgs, sctx);","handlingStrategy":"validation","validationCode":"var ns = unknownTypeNamespace ?? string.Empty;\nvar xt = new XamlType(ns, unknownTypeName, typeArguments, schemaContext);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Coalesce null namespaces to string.Empty when constructing unknown XamlTypes, matching the protected overload's behavior.","Validate parse output so an absent namespace becomes an explicit empty string, not null."],"tags":["xaml","argument-null","xamltype"],"backgroundTag":null,"analyzedSha":"04183404888ea21b4e5bfa3493e8d5f15e972c3a","analyzedAt":"2026-08-13T21:08:11.651Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}