{"record":{"id":"dff80a22d369f1f8","repo":"unoplatform/uno","slug":"type-dff80a","errorCode":null,"errorMessage":"type","messagePattern":"type","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/SourceGenerators/System.Xaml/System.Xaml.Permissions/XamlAccessLevel.cs","lineNumber":67,"sourceCode":"\n\t\t\treturn new XamlAccessLevel (assemblyName);\n\t\t}\n\n\t\tpublic static XamlAccessLevel PrivateAccessTo (string assemblyQualifiedTypeName)\n\t\t{\n\t\t\tif (assemblyQualifiedTypeName == null)\n\t\t\t{\n\t\t\t\tthrow new ArgumentNullException (\"assemblyQualifiedTypeName\");\n\t\t\t}\n\n\t\t\treturn new XamlAccessLevel (assemblyQualifiedTypeName);\n\t\t}\n\n\t\tpublic static XamlAccessLevel PrivateAccessTo (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\treturn new XamlAccessLevel (type.AssemblyQualifiedName);\n\t\t}\n\n\t\tinternal XamlAccessLevel (AssemblyName assemblyAccessToAssemblyName)\n\t\t{\n\t\t\tAssemblyAccessToAssemblyName = assemblyAccessToAssemblyName;\n\t\t}\n\n\t\tinternal XamlAccessLevel (string privateAccessToTypeName)\n\t\t{\n\t\t\tPrivateAccessToTypeName = privateAccessToTypeName;\n\t\t}\n\n\t\tpublic AssemblyName AssemblyAccessToAssemblyName { get; private set; }\n\t\tpublic string PrivateAccessToTypeName { get; private set; }\n\t}","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/unoplatform/uno/blob/04183404888ea21b4e5bfa3493e8d5f15e972c3a/src/SourceGenerators/System.Xaml/System.Xaml.Permissions/XamlAccessLevel.cs#L49-L85","documentation":"Thrown by XamlAccessLevel.PrivateAccessTo(Type) when the type argument is null. The method reads type.AssemblyQualifiedName to forward to the string overload, so a null type is rejected first.","triggerScenarios":"Calling PrivateAccessTo((Type)null), typically from a reflection path that returned null (e.g. Type.GetType on an unresolvable name).","commonSituations":"Loading XAML access settings from config that names a type not present at runtime; cross-platform code where a type is conditionally compiled out; AOT/trimming that removed the type.","solutions":["Resolve the Type with a non-failing lookup and null-check before calling.","Catch TypeLoadException at the resolution step and surface a clearer domain error.","Use the string overload only when you have a verified assembly-qualified name."],"exampleFix":"// before\nvar t = Type.GetType(\"Missing.Foo, Missing\"); // null\nvar lvl = XamlAccessLevel.PrivateAccessTo(t); // throws\n\n// after\nvar t = Type.GetType(\"Missing.Foo, Missing\") ?? throw new TypeLoadException();\nvar lvl = XamlAccessLevel.PrivateAccessTo(t);","handlingStrategy":"validation","validationCode":"var t = Type.GetType(qualifiedName) ?? throw new TypeLoadException(qualifiedName);\nvar lvl = XamlAccessLevel.PrivateAccessTo(t);","typeGuard":"static bool IsTypeResolved(Type t) => t != null;","tryCatchPattern":null,"preventionTips":["Resolve types via a single helper that throws on null.","Validate config-supplied type names at startup against loaded assemblies.","Account for platform/TFM differences that may remove a type."],"tags":["xaml","access-level","permissions","argument-null","uno"],"backgroundTag":null,"analyzedSha":"04183404888ea21b4e5bfa3493e8d5f15e972c3a","analyzedAt":"2026-08-13T21:08:11.651Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}