{"record":{"id":"4dbccf94ce680834","repo":"unoplatform/uno","slug":"elements","errorCode":null,"errorMessage":"elements","messagePattern":"elements","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/SourceGenerators/System.Xaml/System.Windows.Markup/ArrayExtension.cs","lineNumber":48,"sourceCode":"using Uno.Xaml.Schema;\n\nnamespace System.Windows.Markup\n{\n\t[MarkupExtensionReturnType (typeof (Array))]\n\t[ContentProperty (\"Items\")]\n\t// [System.Runtime.CompilerServices.TypeForwardedFrom (Consts.AssemblyPresentationFramework_3_5)]\n\tpublic class ArrayExtension : MarkupExtension\n\t{\n\t\tpublic ArrayExtension ()\n\t\t{\t\t\n\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\")]","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/unoplatform/uno/blob/04183404888ea21b4e5bfa3493e8d5f15e972c3a/src/SourceGenerators/System.Xaml/System.Windows.Markup/ArrayExtension.cs#L30-L66","documentation":"ArgumentNullException thrown by the ArrayExtension markup extension (System.Xaml, ported from Mono) when its ArrayExtension(Array elements) constructor is called with a null array. x:ArrayExtension is the XAML construct used to build an array inline in markup; the constructor defensively rejects a null source array. The parameter name 'elements' identifies which argument is null.","triggerScenarios":"Programmatic construction 'new ArrayExtension((Array)null)' or a code path that resolves the array argument to null before invoking the constructor.","commonSituations":"Code-generated or reflection-driven instantiation passing null, a binding that yields null feeding the constructor, or a test invoking the constructor directly without a value.","solutions":["Pass a non-null Array to the constructor; null-check at the call site before constructing.","If the source may legitimately be null, return early or use the parameterless ArrayExtension() and add items via Items.","Add a guard at the caller so a null never reaches the constructor."],"exampleFix":"// before\nvar ext = new ArrayExtension(maybeNullArray);\n\n// after\nvar ext = maybeNullArray is null\n    ? new ArrayExtension(typeof(int))\n    : new ArrayExtension(maybeNullArray);","handlingStrategy":"validation","validationCode":"static ArrayExtension SafeArrayExt(Array src) => src is null ? new ArrayExtension() : new ArrayExtension(src);","typeGuard":"static bool IsNonEmptyArray(object o) => o is Array { Length: > 0 };","tryCatchPattern":"try { var ext = new ArrayExtension(src); } catch (ArgumentNullException ex) when (ex.ParamName == \"elements\") { ext = new ArrayExtension(); }","preventionTips":["Null-check arrays at the call site before constructing ArrayExtension.","Use the parameterless constructor when the source may legitimately be null."],"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-14T00:17:13.853Z"}