{"record":{"id":"6e12520ff8c113ad","repo":"unoplatform/uno","slug":"arraytype","errorCode":null,"errorMessage":"arrayType","messagePattern":"arrayType","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/SourceGenerators/System.Xaml/System.Windows.Markup/ArrayExtension.cs","lineNumber":59,"sourceCode":"\t\t\titems = new ArrayList ();\n\t\t}\n\n\t\tpublic ArrayExtension (Array elements)\n\t\t{\n\t\t\tif (elements == null)\n\t\t\t{\n\t\t\t\tthrow new ArgumentNullException (\"elements\");\n\t\t\t}\n\n\t\t\tType = elements.GetType ().GetElementType ();\n\t\t\titems = new ArrayList (elements);\n\t\t}\n\n\t\tpublic ArrayExtension (Type arrayType)\n\t\t{\n\t\t\tif (arrayType == null)\n\t\t\t{\n\t\t\t\tthrow new ArgumentNullException (\"arrayType\");\n\t\t\t}\n\n\t\t\tType = arrayType;\n\t\t\titems = new ArrayList ();\n\t\t}\n\n\t\t[ConstructorArgument (\"arrayType\")]\n\t\tpublic Type Type { get; set; }\n\n\t\tIList items;\n\t\t[DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]\n\t\tpublic IList Items {\n\t\t\tget { return items; }\n\t\t}\n\n\t\tpublic void AddChild (Object value)\n\t\t{\n\t\t\t// null is allowed.","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/unoplatform/uno/blob/04183404888ea21b4e5bfa3493e8d5f15e972c3a/src/SourceGenerators/System.Xaml/System.Windows.Markup/ArrayExtension.cs#L41-L77","documentation":"ArgumentNullException thrown by ArrayExtension (System.Xaml, ported from Mono) when its ArrayExtension(Type arrayType) constructor is called with a null Type. This constructor sets the element type of the array to build; a null type is meaningless, so it is rejected with parameter name 'arrayType'.","triggerScenarios":"Programmatic construction 'new ArrayExtension((Type)null)' or a reflection/code-gen path where the type argument resolves to null (e.g. Type.GetType returning null for an unresolvable name).","commonSituations":"Type.GetType(\"UnknownType\") yielding null passed in, a config-driven array-type name that fails to resolve, or unit tests constructing the extension without a concrete type.","solutions":["Resolve the Type before constructing and null-check it; surface a clear error if the type name cannot be resolved.","Use the parameterless constructor and set the Type property explicitly after validation.","Validate the type name string against loaded assemblies before Type.GetType."],"exampleFix":"// before\nvar t = Type.GetType(configTypeName);\nvar ext = new ArrayExtension(t); // t may be null\n\n// after\nvar t = Type.GetType(configTypeName)\n    ?? throw new ConfigurationException($\"Unknown array type '{configTypeName}'.\");\nvar ext = new ArrayExtension(t);","handlingStrategy":"validation","validationCode":"static ArrayExtension ArrayExtOfType(string typeName) { var t = Type.GetType(typeName) ?? throw new ConfigurationException($\"Unknown type '{typeName}'.\"); return new ArrayExtension(t); }","typeGuard":"static bool IsResolvableType(string name) => Type.GetType(name) is not null;","tryCatchPattern":"try { return new ArrayExtension(t); } catch (ArgumentNullException ex) when (ex.ParamName == \"arrayType\") { throw new ConfigurationException(\"Array element type could not be resolved.\"); }","preventionTips":["Resolve and null-check Type via Type.GetType before constructing.","Validate type names against loaded assemblies at startup.","Use the parameterless constructor and set Type explicitly after validation."],"tags":["xaml","markup-extension","x-array","argumentnull","system-xaml"],"backgroundTag":null,"analyzedSha":"04183404888ea21b4e5bfa3493e8d5f15e972c3a","analyzedAt":"2026-08-13T21:08:11.651Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}