cefsharp/CefSharp · error · InvalidOperationException
Property {0} not found on Object of Type {1}
Error message
Property {0} not found on Object of Type {1} What it means
Thrown by TryGetProperty (the getter path) when the bound object was found via objectId but no property has a JavascriptName matching the requested name. As with the methods, the object-not-found case returns false without throwing, while a property-name mismatch raises InvalidOperationException. The message prints the requested property name and the object's runtime type.
Source
Thrown at CefSharp/Internals/JavascriptObjectRepository.cs:589
bool IJavascriptObjectRepositoryInternal.TryGetProperty(long objectId, string name, out object result, out string exception)
{
return TryGetProperty(objectId, name, out result, out exception);
}
protected virtual bool TryGetProperty(long objectId, string name, out object result, out string exception)
{
exception = "";
result = null;
JavascriptObject obj;
if (!objects.TryGetValue(objectId, out obj))
{
return false;
}
var property = obj.Properties.FirstOrDefault(p => p.JavascriptName == name);
if (property == null)
{
throw new InvalidOperationException(string.Format("Property {0} not found on Object of Type {1}", name, obj.Value.GetType()));
}
try
{
if (obj.PropertyInterceptor == null)
{
result = property.GetValue(obj.Value);
}
else
{
result = obj.PropertyInterceptor.InterceptGet(() => property.GetValue(obj.Value), property.ManagedName);
}
return true;
}
catch (Exception ex)
{
exception = ex.ToString();
}View on GitHub (pinned to 16bc6e0711)
Solutions
- Read the property by its JavaScript (camelCase) name.
- Confirm the property is in obj.Properties and not excluded by BindingOptions.
- Regenerate JS/TS bindings after C# property renames.
- Audit binding options that restrict which properties are exposed.
Example fix
// C#: public string UserName { get; set; } -> JS name "userName"
// before (JS): const n = obj.username; // typo/wrong casing
// after (JS): const n = obj.userName; Defensive patterns
Strategy: validation
Validate before calling
var exposedProps = obj.Properties.Select(p => p.JavascriptName);
if (!exposedProps.Contains(jsPropName, StringComparer.Ordinal))
throw new InvalidOperationException($"Property {jsPropName} not exposed."); Try / catch
try { repository.TryGetProperty(objectId, name, out value, out ex); }
catch (InvalidOperationException ex) when (ex.Message.Contains("Property") && ex.Message.Contains("not found"))
{ /* property name mismatch from JS */ } Prevention
- Read properties by their camelCase JavaScript name.
- Regenerate contracts after property renames.
- Verify BindingOptions did not filter the property.
When it happens
Trigger: JavaScript reads a property by a name that does not exist on the bound object (typo, casing, or property filtered out by BindingOptions); reading a property on the wrong object id.
Common situations: Renaming a C# property and not updating JS; relying on the managed name instead of the camelCase JS name; property excluded from binding; stale generated contract.
Related errors
- Method {0} not found on Object of Type {1}
- name
- value
- To enable synchronous JS bindings set WcfEnabled true in Cef
- Object already bound with name:{name}
AI-assisted analysis of cefsharp/CefSharp@16bc6e0711 (2026-08-13).
Data as JSON: /api/errors/b5fde79d8df5658e.
Report an issue: GitHub.