{"record":{"id":"7d355a0f29f9ec41","repo":"unoplatform/uno","slug":"type-7d355a","errorCode":null,"errorMessage":"type","messagePattern":"type","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/SourceGenerators/System.Xaml/System.Windows.Markup/ValueSerializer.cs","lineNumber":74,"sourceCode":"\t\t\tif (context != null)\n\t\t\t{\n\t\t\t\treturn context.GetValueSerializerFor (descriptor);\n\t\t\t}\n\n\t\t\tvar tc = descriptor.Converter;\n\t\t\tif (tc != null && tc.GetType () != typeof (TypeConverter))\n\t\t\t{\n\t\t\t\treturn new TypeConverterValueSerializer (tc);\n\t\t\t}\n\n\t\t\treturn null;\n\t\t}\n\n\t\tpublic static ValueSerializer GetSerializerFor (Type type, IValueSerializerContext context)\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\tif (context != null)\n\t\t\t{\n\t\t\t\treturn context.GetValueSerializerFor (type);\n\t\t\t}\n\n\t\t\t// Standard MarkupExtensions are serialized without ValueSerializer.\n\t\t\tif (typeof (MarkupExtension).IsAssignableFrom (type) && XamlLanguage.AllTypes.Any (x => x.UnderlyingType == type))\n\t\t\t{\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\t// DateTime is documented as special.\n\t\t\tif (type == typeof (DateTime))\n\t\t\t{\n\t\t\t\treturn new DateTimeValueSerializer ();\n\t\t\t}","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/unoplatform/uno/blob/04183404888ea21b4e5bfa3493e8d5f15e972c3a/src/SourceGenerators/System.Xaml/System.Windows.Markup/ValueSerializer.cs#L56-L92","documentation":"Thrown by ValueSerializer.GetSerializerFor(Type, IValueSerializerContext) when the type argument is null. The method needs the type to consult the context and to check whether it is a known MarkupExtension, so it rejects null up front.","triggerScenarios":"Calling GetSerializerFor((Type)null, context), commonly when the type was derived from a null-valued property or an unresolved reflection result.","commonSituations":"Serialization code that walks a member list where UnderlyingType can be null (e.g. attached properties, directives); typeof lookups that returned null on a trimmed/AOT scenario.","solutions":["Resolve the Type (via GetType/UnderlyingType) and null-check before calling.","Skip members whose UnderlyingType is null rather than passing null through.","Use GetSerializerFor(PropertyDescriptor,...) when only a descriptor is available."],"exampleFix":"// before\nType t = member.UnderlyingType; // may be null\nvar ser = ValueSerializer.GetSerializerFor(t, ctx); // throws\n\n// after\nType t = member.UnderlyingType;\nvar ser = t != null ? ValueSerializer.GetSerializerFor(t, ctx) : null;","handlingStrategy":"validation","validationCode":"Type t = member.UnderlyingType;\nif (t == null) return null; // nothing to serialize\nvar ser = ValueSerializer.GetSerializerFor(t, ctx);","typeGuard":"static bool HasSerializableType(Type t) => t != null;","tryCatchPattern":null,"preventionTips":["Filter members whose UnderlyingType is null before serializing.","Use the descriptor overload when a type is unavailable.","Document which member kinds (directives, attached) may have null types."],"tags":["xaml","value-serializer","argument-null","uno"],"backgroundTag":null,"analyzedSha":"04183404888ea21b4e5bfa3493e8d5f15e972c3a","analyzedAt":"2026-08-13T21:08:11.651Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}