dotnet/wpf · error

ArgumentNullException(nameof(typeFullName))

Error message

ArgumentNullException(nameof(typeFullName))

What it means

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)).

Solutions

  1. Resolve the element's type name before constructing the node; pass the resolved full name.
  2. Add a null check on the type name at the call site before node construction.
  3. If the type cannot be resolved, fail earlier with a clearer diagnostic rather than passing null.

Example fix

// before
var node = new XamlPropertyBaseNode(propertyMember, assemblyName, null, propName, ...);
// after
if (string.IsNullOrEmpty(typeFullName)) throw new ArgumentException("type must be resolved", nameof(typeFullName));
var node = new XamlPropertyBaseNode(propertyMember, assemblyName, typeFullName, propName, ...);
Defensive patterns

Strategy: validation

Validate before calling

if (string.IsNullOrEmpty(typeFullName)) throw new InvalidOperationException("XAML type could not be resolved before node creation");

Type guard

bool HasTypeName(XamlTypeMapping type) => !string.IsNullOrEmpty(type?.FullName);

Try / catch

try { node = new XamlPropertyBaseNode(...); }
catch (ArgumentNullException) { /* log unresolved type and skip node */ }

Prevention

When it happens

Trigger: Constructing XamlPropertyBaseNode (or a derived node type) with typeFullName == null, typically in custom XAML parser/reader code that builds node streams manually.

Common situations: 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.

Related errors


AI-assisted analysis of dotnet/wpf@81131a70a4 (2026-09-14). Data as JSON: /api/errors/3708cd8e31d8c948. Report an issue: GitHub.

Appendix: source

Thrown at src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/XamlNodes.cs:431

            /// Constructor
            /// </summary>
            internal XamlPropertyBaseNode(
                XamlNodeType   token,
                int         lineNumber,
                int         linePosition,
                int         depth,
                object      propertyMember,    // DependencyProperty or MethodInfo or PropertyInfo
                string      assemblyName,
                string      typeFullName,
                string      propertyName)
                : base (token,
                        lineNumber,
                        linePosition,
                        depth)
            {
                if (typeFullName == null)
                {
                    throw new ArgumentNullException(nameof(typeFullName));
                }
                if (propertyName == null)
                {
                    throw new ArgumentNullException(nameof(propertyName));
                }
                
                _propertyMember = propertyMember;
                _assemblyName = assemblyName;
                _typeFullName = typeFullName;
                _propName = propertyName;
            }
            
#if PBTCOMPILER
            /// <summary>
            /// PropertyInfo for the property for the Node.  This may be null.
            /// </summary>
            internal PropertyInfo PropInfo
            {

View on GitHub (pinned to 81131a70a4)