{"record":{"id":"3708cd8e31d8c948","repo":"dotnet/wpf","slug":"argumentnullexception-nameof-typefullname","errorCode":null,"errorMessage":"ArgumentNullException(nameof(typeFullName))","messagePattern":"ArgumentNullException\\(nameof\\(typeFullName\\)\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/XamlNodes.cs","lineNumber":431,"sourceCode":"            /// Constructor\n            /// </summary>\n            internal XamlPropertyBaseNode(\n                XamlNodeType   token,\n                int         lineNumber,\n                int         linePosition,\n                int         depth,\n                object      propertyMember,    // DependencyProperty or MethodInfo or PropertyInfo\n                string      assemblyName,\n                string      typeFullName,\n                string      propertyName)\n                : base (token,\n                        lineNumber,\n                        linePosition,\n                        depth)\n            {\n                if (typeFullName == null)\n                {\n                    throw new ArgumentNullException(nameof(typeFullName));\n                }\n                if (propertyName == null)\n                {\n                    throw new ArgumentNullException(nameof(propertyName));\n                }\n                \n                _propertyMember = propertyMember;\n                _assemblyName = assemblyName;\n                _typeFullName = typeFullName;\n                _propName = propertyName;\n            }\n            \n#if PBTCOMPILER\n            /// <summary>\n            /// PropertyInfo for the property for the Node.  This may be null.\n            /// </summary>\n            internal PropertyInfo PropInfo\n            {","sourceCodeStart":413,"sourceCodeEnd":449,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/XamlNodes.cs#L413-L449","documentation":"The XamlPropertyBaseNode constructor in XamlNodes.cs requires a non-null fully-qualified type name because the node must identify which type owns the property. Passing null typeFullName causes ArgumentNullException(nameof(typeFullName)).","triggerScenarios":"Constructing XamlPropertyBaseNode (or a derived node type) with typeFullName == null, typically in custom XAML parser/reader code that builds node streams manually.","commonSituations":"Custom XamlNode implementations, parser extensions that lose type resolution (e.g. failing to resolve an xmlns mapping) and then pass null through to the node constructor.","solutions":["Resolve the element's type name before constructing the node; pass the resolved full name.","Add a null check on the type name at the call site before node construction.","If the type cannot be resolved, fail earlier with a clearer diagnostic rather than passing null."],"exampleFix":"// before\nvar node = new XamlPropertyBaseNode(propertyMember, assemblyName, null, propName, ...);\n// after\nif (string.IsNullOrEmpty(typeFullName)) throw new ArgumentException(\"type must be resolved\", nameof(typeFullName));\nvar node = new XamlPropertyBaseNode(propertyMember, assemblyName, typeFullName, propName, ...);","handlingStrategy":"validation","validationCode":"if (string.IsNullOrEmpty(typeFullName)) throw new InvalidOperationException(\"XAML type could not be resolved before node creation\");","typeGuard":"bool HasTypeName(XamlTypeMapping type) => !string.IsNullOrEmpty(type?.FullName);","tryCatchPattern":"try { node = new XamlPropertyBaseNode(...); }\ncatch (ArgumentNullException) { /* log unresolved type and skip node */ }","preventionTips":["Resolve xmlns->type mappings before building node streams.","Never pass nullable type names into node constructors; normalize to string.Empty-safe resolution errors."],"tags":["wpf","xaml","argument-null"],"backgroundTag":"null-argument","analyzedSha":"81131a70a4c573cd62748a5c36908fc4d662daa9","analyzedAt":"2026-09-14T10:12:48.479Z","contentChangedAt":"2026-09-14T10:12:48.479Z","schemaVersion":2},"datasetVersion":"2026-09-21T21:30:21.729Z"}