{"record":{"id":"c1469af50b01e247","repo":"unoplatform/uno","slug":"type","errorCode":null,"errorMessage":"type","messagePattern":"type","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/SourceGenerators/System.Xaml/System.Windows.Markup/TypeExtension.cs","lineNumber":55,"sourceCode":"\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; }\n\t\t[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]\n\t\tpublic string TypeName { get; set; }\n\n\t\tpublic override object ProvideValue (IServiceProvider serviceProvider)\n\t\t{\n\t\t\tif (Type != null)\n\t\t\t{\n\t\t\t\treturn Type;\n\t\t\t}\n","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/unoplatform/uno/blob/04183404888ea21b4e5bfa3493e8d5f15e972c3a/src/SourceGenerators/System.Xaml/System.Windows.Markup/TypeExtension.cs#L37-L73","documentation":"Thrown by the TypeExtension(Type type) constructor when a null Type is supplied. The constructor stores the argument into the Type property which ProvideValue returns directly, so a null would propagate; the check rejects it at the boundary.","triggerScenarios":"Constructing new TypeExtension((Type)null), or passing a typeof() expression whose target could not be resolved at compile/runtime.","commonSituations":"Building a TypeExtension from a reflection lookup that returned null; platform-conditional code where a type may not exist on a target TFM.","solutions":["Pass a concrete, non-null System.Type obtained via typeof() or a successful Type.GetType call.","Guard the type resolution result before constructing the extension.","Fall back to the string constructor with an assembly-qualified name when the Type is unavailable."],"exampleFix":"// before\nvar t = Type.GetType(\"MyLib.Foo, MyLib\");\nvar ext = new TypeExtension(t); // throws if getType returned null\n\n// after\nvar t = Type.GetType(\"MyLib.Foo, MyLib\") ?? throw new TypeLoadException(\"MyLib.Foo missing\");\nvar ext = new TypeExtension(t);","handlingStrategy":"validation","validationCode":"Type t = ResolveType() ?? throw new TypeLoadException(\"type not found\");\nvar ext = new TypeExtension(t);","typeGuard":"static bool IsKnownType(Type t) => t != null && !t.IsGenericTypeDefinition || t != null;","tryCatchPattern":null,"preventionTips":["Resolve types through a single helper that throws on null so callers never see this error.","Use typeof() where possible to get compile-time guarantees.","Watch platform-conditional types that may be absent on a TFM."],"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"}