{"record":{"id":"285314cda41c8f7f","repo":"unoplatform/uno","slug":"typename","errorCode":null,"errorMessage":"typeName","messagePattern":"typeName","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/SourceGenerators/System.Xaml/System.Windows.Markup/TypeExtension.cs","lineNumber":45,"sourceCode":"using System.Reflection;\nusing Uno.Xaml.Schema;\n\nnamespace System.Windows.Markup\n{\n\t[MarkupExtensionReturnType (typeof (Type))]\n\t[TypeConverter (typeof (TypeExtensionConverter))]\n\t// [System.Runtime.CompilerServices.TypeForwardedFrom (Consts.AssemblyPresentationFramework_3_5)]\n\tpublic class TypeExtension : MarkupExtension\n\t{\n\t\tpublic TypeExtension ()\n\t\t{\n\t\t}\n\n\t\tpublic TypeExtension (string typeName)\n\t\t{\n\t\t\tif (typeName == null)\n\t\t\t{\n\t\t\t\tthrow new ArgumentNullException (\"typeName\");\n\t\t\t}\n\n\t\t\tTypeName = typeName;\n\t\t}\n\n\t\tpublic TypeExtension (Type type)\n\t\t{\n\t\t\tif (type == null)\n\t\t\t{\n\t\t\t\tthrow new ArgumentNullException (\"type\");\n\t\t\t}\n\n\t\t\tType = type;\n\t\t}\n\n\t\t[ConstructorArgument (\"type\")]\n\t\t[DefaultValue (null)]\n\t\tpublic Type Type { get; set; }","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/unoplatform/uno/blob/04183404888ea21b4e5bfa3493e8d5f15e972c3a/src/SourceGenerators/System.Xaml/System.Windows.Markup/TypeExtension.cs#L27-L63","documentation":"Thrown by the TypeExtension(string typeName) constructor when null is passed. The constructor immediately assigns the argument to TypeName, so a null would leave the extension in an invalid state; the guard fails fast instead.","triggerScenarios":"Constructing new TypeExtension((string)null) directly, or via reflection/deserialization that resolves the string overload with a null argument.","commonSituations":"Code that builds TypeExtension from a nullable string without checking; XAML converters that pass through unresolved type-name bindings as null.","solutions":["Pass a non-null, assembly-qualified or namespace-qualified type name string.","Null-check the input before constructing: if (name != null) ext = new TypeExtension(name);.","Prefer the TypeExtension(Type) overload when you already have a System.Type instance."],"exampleFix":"// before\nstring name = GetNameOrNull();\nvar ext = new TypeExtension(name); // throws if null\n\n// after\nstring name = GetNameOrNull() ?? throw new InvalidOperationException(\"type name required\");\nvar ext = new TypeExtension(name);","handlingStrategy":"validation","validationCode":"string name = ResolveTypeName() ?? throw new InvalidOperationException(\"type name required\");\nvar ext = new TypeExtension(name);","typeGuard":"static bool IsValidTypeName(string s) => !string.IsNullOrWhiteSpace(s);","tryCatchPattern":null,"preventionTips":["Null-check nullable strings before passing to the TypeExtension constructor.","Prefer the TypeExtension(Type) overload when a Type instance is already available.","Centralize type-name resolution so nulls surface as a single, well-described error."],"tags":["xaml","markup-extension","type-extension","argument-null","uno"],"backgroundTag":null,"analyzedSha":"04183404888ea21b4e5bfa3493e8d5f15e972c3a","analyzedAt":"2026-08-13T21:08:11.651Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}