{"record":{"id":"83086a37a19790c4","repo":"unoplatform/uno","slug":"assembly","errorCode":null,"errorMessage":"assembly","messagePattern":"assembly","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/SourceGenerators/System.Xaml/System.Xaml.Permissions/XamlAccessLevel.cs","lineNumber":38,"sourceCode":"// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nusing System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Reflection;\nusing Uno.Xaml;\n\nnamespace Uno.Xaml.Permissions\n{\n\t[SerializableAttribute]\n\tpublic class XamlAccessLevel\n\t{\n\t\tpublic static XamlAccessLevel AssemblyAccessTo (Assembly assembly)\n\t\t{\n\t\t\tif (assembly == null)\n\t\t\t{\n\t\t\t\tthrow new ArgumentNullException (\"assembly\");\n\t\t\t}\n\n\t\t\treturn new XamlAccessLevel (assembly.GetName ());\n\t\t}\n\t\tpublic static XamlAccessLevel AssemblyAccessTo (AssemblyName assemblyName)\n\t\t{\n\t\t\tif (assemblyName == null)\n\t\t\t{\n\t\t\t\tthrow new ArgumentNullException (\"assemblyName\");\n\t\t\t}\n\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{","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/unoplatform/uno/blob/04183404888ea21b4e5bfa3493e8d5f15e972c3a/src/SourceGenerators/System.Xaml/System.Xaml.Permissions/XamlAccessLevel.cs#L20-L56","documentation":"Thrown by XamlAccessLevel.AssemblyAccessTo(Assembly) when the assembly argument is null. The method extracts assembly.GetName() to build the access level, so a null assembly has no identity to record.","triggerScenarios":"Calling AssemblyAccessTo with a null Assembly, e.g. from a type whose Assembly property resolved to null in a reflection-less/AOT environment, or from a partially-loaded module.","commonSituations":"Dynamic loading where Assembly.Load returned null; sandboxing code that constructs XamlAccessLevel from caller-supplied assemblies without validation; trimmed binaries where type.Assembly is null.","solutions":["Resolve the assembly via type.Assembly or Assembly.Load and verify non-null before calling.","Use the AssemblyName overload when you only have identity metadata.","Guard at the boundary: if (asm == null) throw your own domain error with context."],"exampleFix":"// before\nvar asm = Assembly.Load(name); // may be null\nvar lvl = XamlAccessLevel.AssemblyAccessTo(asm); // throws\n\n// after\nvar asm = Assembly.Load(name) ?? throw new FileNotFoundException(name);\nvar lvl = XamlAccessLevel.AssemblyAccessTo(asm);","handlingStrategy":"validation","validationCode":"var asm = type.Assembly ?? throw new InvalidOperationException(\"no assembly\");\nvar lvl = XamlAccessLevel.AssemblyAccessTo(asm);","typeGuard":"static bool IsAssemblyKnown(Assembly a) => a != null;","tryCatchPattern":null,"preventionTips":["Resolve assemblies via type.Assembly to guarantee non-null.","Prefer the AssemblyName overload when only metadata is available.","Null-check after Assembly.Load and surface a domain-specific error."],"tags":["xaml","access-level","permissions","argument-null","uno"],"backgroundTag":null,"analyzedSha":"04183404888ea21b4e5bfa3493e8d5f15e972c3a","analyzedAt":"2026-08-13T21:08:11.651Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}