cefsharp/CefSharp · error · ArgumentNullException
propertyInfo
Error message
propertyInfo
What it means
Thrown by the BindingMemberInfo(PropertyInfo) constructor when propertyInfo is null. The constructor stores the member info and reads PropertyType/Name from it, so a null reference would otherwise cause a NullReferenceException later; the guard fails fast with ArgumentNullException naming 'propertyInfo'.
Source
Thrown at CefSharp/ModelBinding/BindingMemberInfo.cs:37
/// <summary>
/// Gets the name of the property or field represented by this BindingMemberInfo.
/// </summary>
public string Name { get; private set; }
/// <summary>
/// Gets the data type of the property or field represented by this BindingMemberInfo.
/// </summary>
public Type Type { get; private set; }
/// <summary>
/// Constructs a BindingMemberInfo instance for a property.
/// </summary>
/// <param name="propertyInfo">The bindable property to represent.</param>
public BindingMemberInfo(PropertyInfo propertyInfo)
{
if (propertyInfo == null)
{
throw new ArgumentNullException("propertyInfo");
}
memberInfo = propertyInfo;
Type = propertyInfo.PropertyType;
Name = propertyInfo.Name;
}
/// <summary>
/// Constructs a BindingMemberInfo instance for a field.
/// </summary>
/// <param name="fieldInfo">The bindable field to represent.</param>
public BindingMemberInfo(FieldInfo fieldInfo)
{
if (fieldInfo == null)
{
throw new ArgumentNullException("fieldInfo");
}View on GitHub (pinned to 16bc6e0711)
Solutions
- Null-check the PropertyInfo (from Type.GetProperty) before constructing BindingMemberInfo.
- Verify the property name/casing used in reflection calls.
- Use nameof() to keep reflection strings in sync with members.
- Fail with a descriptive error at the reflection site if the property is not found.
Example fix
// before
var pi = type.GetProperty("Titel"); // misspelling -> null
var bm = new BindingMemberInfo(pi);
// after
var pi = type.GetProperty(nameof(MyVm.Title));
if (pi == null) throw new InvalidOperationException("Property not found on " + type);
var bm = new BindingMemberInfo(pi); Defensive patterns
Strategy: type-guard
Validate before calling
var pi = type.GetProperty(nameof(MyVm.Title));
if (pi == null) throw new InvalidOperationException("Property not found on " + type.FullName);
var bm = new BindingMemberInfo(pi); Type guard
static bool TryCreate(PropertyInfo pi, out BindingMemberInfo bm) {
bm = pi == null ? default : new BindingMemberInfo(pi); return pi != null; } Try / catch
try { var bm = new BindingMemberInfo(pi); }
catch (ArgumentNullException ex) when (ex.ParamName == "propertyInfo")
{ /* reflection miss; log and skip member */ } Prevention
- Null-check reflection results before constructing.
- Use nameof() to bind reflection strings to real members.
- Fail at the reflection site with a clear message.
When it happens
Trigger: Passing a PropertyInfo obtained via reflection that resolved to null (e.g. Type.GetProperty returned null for a misspelled/missing property), or passing a nullable expression without a null check.
Common situations: Reflecting over a member name that does not exist; refactoring a class so the reflected property disappears; binding infrastructure receiving a null from an upstream filter.
Related errors
AI-assisted analysis of cefsharp/CefSharp@16bc6e0711 (2026-08-13).
Data as JSON: /api/errors/c5fe5249ae700c68.
Report an issue: GitHub.