{"record":{"id":"c1f5b3aaf588ff70","repo":"cefsharp/CefSharp","slug":"fieldinfo","errorCode":null,"errorMessage":"fieldInfo","messagePattern":"fieldInfo","errorType":"validation","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"CefSharp/ModelBinding/BindingMemberInfo.cs","lineNumber":54,"sourceCode":"            {\n                throw new ArgumentNullException(\"propertyInfo\");\n            }\n\n            memberInfo = propertyInfo;\n\n            Type = propertyInfo.PropertyType;\n            Name = propertyInfo.Name;\n        }\n\n        /// <summary>\n        /// Constructs a BindingMemberInfo instance for a field.\n        /// </summary>\n        /// <param name=\"fieldInfo\">The bindable field to represent.</param>\n        public BindingMemberInfo(FieldInfo fieldInfo)\n        {\n            if (fieldInfo == null)\n            {\n                throw new ArgumentNullException(\"fieldInfo\");\n            }\n\n            memberInfo = fieldInfo;\n\n            Type = fieldInfo.FieldType;\n            Name = fieldInfo.Name;\n        }\n\n        /// <summary>\n        /// Sets the value from a specified object associated with the property or field represented by this BindingMemberInfo.\n        /// </summary>\n        /// <param name=\"destinationObject\">The object whose property or field should be assigned.</param>\n        /// <param name=\"newValue\">The value to assign in the specified object to this BindingMemberInfo's property or field.</param>\n        public void SetValue(object destinationObject, object newValue)\n        {\n            if (memberInfo is PropertyInfo)\n            {\n                ((PropertyInfo)memberInfo).SetValue(destinationObject, newValue, null);","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/cefsharp/CefSharp/blob/16bc6e0711a4945be17e8bc4bc7ccf9469f3fdec/CefSharp/ModelBinding/BindingMemberInfo.cs#L36-L72","documentation":"Thrown by the BindingMemberInfo(FieldInfo) constructor when fieldInfo is null. Like the PropertyInfo overload, the constructor reads FieldType/Name from the argument, so the guard fails fast with ArgumentNullException naming 'fieldInfo' instead of letting a null slip through to a later NullReferenceException.","triggerScenarios":"Passing a FieldInfo from Type.GetField that returned null (misspelled or non-existent field name), or a nullable expression without a prior null check.","commonSituations":"Reflecting over a field name that does not exist; class refactor removing the field; binding filter passing a null upstream.","solutions":["Null-check the FieldInfo (from Type.GetField) before constructing BindingMemberInfo.","Confirm the field name/casing used in reflection.","Use nameof() to keep reflection lookups bound to real members.","Throw a clear error at the reflection site when the field is absent."],"exampleFix":"// before\nvar fi = type.GetField(\"Flag\"); // field renamed -> null\nvar bm = new BindingMemberInfo(fi);\n\n// after\nvar fi = type.GetField(nameof(MyVm.Flag));\nif (fi == null) throw new InvalidOperationException(\"Field not found on \" + type);\nvar bm = new BindingMemberInfo(fi);","handlingStrategy":"type-guard","validationCode":"var fi = type.GetField(nameof(MyVm.Flag));\nif (fi == null) throw new InvalidOperationException(\"Field not found on \" + type.FullName);\nvar bm = new BindingMemberInfo(fi);","typeGuard":"static bool TryCreate(FieldInfo fi, out BindingMemberInfo bm) {\n    bm = fi == null ? default : new BindingMemberInfo(fi); return fi != null; }","tryCatchPattern":"try { var bm = new BindingMemberInfo(fi); }\ncatch (ArgumentNullException ex) when (ex.ParamName == \"fieldInfo\")\n{ /* reflection miss; log and skip member */ }","preventionTips":["Null-check reflection results before constructing.","Use nameof() for field lookups.","Throw a descriptive error at the reflection site."],"tags":["cefsharp","model-binding","reflection","argument-validation","null-reference"],"backgroundTag":null,"analyzedSha":"16bc6e0711a4945be17e8bc4bc7ccf9469f3fdec","analyzedAt":"2026-08-13T19:57:05.828Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}