cefsharp/CefSharp · error · Exception
{GetType().Name}.{memberName} can no longer be modified, set
Error message
{GetType().Name}.{memberName} can no longer be modified, settings must be changed before the underlying browser has been created. What it means
Thrown by FreezableBase.ThrowIfFrozen when a property/method of a freezable settings object (e.g. JavascriptBindingSettings, or JavascriptObjectRepository) is modified after Freeze() was called. CefSharp freezes settings once the underlying browser/context is created so that configuration cannot change mid-lifecycle; the message identifies the offending type.member (via CallerMemberName). The exception uses a base Exception with a composite message.
Source
Thrown at CefSharp/Internals/FreezableBase.cs:25
namespace CefSharp.Internals
{
/// <summary>
/// Base classes for Feezable settings objects
/// </summary>
public class FreezableBase
{
private bool frozen;
public void Freeze()
{
frozen = true;
}
protected void ThrowIfFrozen([System.Runtime.CompilerServices.CallerMemberName] string memberName = "")
{
if (frozen)
{
throw new Exception(GetType().Name + "." + memberName + " can no longer be modified, settings must be changed before the underlying browser has been created.");
}
}
}
}
View on GitHub (pinned to 16bc6e0711)
Solutions
- Configure all FreezableBase settings before creating the browser/repository that consumes them.
- Do not mutate JavascriptBindingSettings properties after the browser is created; create a new settings instance for a new browser.
- Register all JS objects up front, since JavascriptObjectRepository.Register freezes the repository.
- If you must change config, recreate the browser/repository with new settings rather than mutating a frozen one.
Example fix
// before (mutates after browser creation)
var settings = new JavascriptBindingSettings();
var browser = new ChromiumWebBrowser(url);
// ... later ...
settings.JavascriptBindingApiEnabled = false; // throws
// after (configure first)
var settings = new JavascriptBindingSettings { JavascriptBindingApiEnabled = false };
var browser = new ChromiumWebBrowser(url); Defensive patterns
Strategy: validation
Validate before calling
// FreezableBase has no public IsFrozen; track in your own lifecycle:
if (!browserCreated)
{
settings.AlwaysInterceptAsynchronously = true;
} Try / catch
try
{
settings.JavascriptBindingApiEnabled = value;
}
catch (Exception ex) when (ex.Message.Contains("can no longer be modified"))
{
// Settings were frozen at browser creation; recreate the browser with new settings instead.
} Prevention
- Configure all FreezableBase settings before creating the browser/repository.
- Register JS objects up front (Register calls Freeze internally).
- Never share and then mutate a settings instance across browsers; create a new one per browser.
When it happens
Trigger: Setting a property (e.g. JavascriptBindingApiEnabled, AlwaysInterceptAsynchronously) on JavascriptBindingSettings after it was frozen, or calling JavascriptObjectRepository.Register through a path that re-triggers a frozen setter. Freeze() is invoked when the browser/repository is bound/initialized.
Common situations: Changing JS binding settings at runtime after the browser is created; reconfiguring a repository that already had an object registered (Register calls Freeze internally); late initialization that touches settings after Cef.Initialize or browser creation; sharing a settings instance across browsers and mutating it for the second one.
Related errors
- IBrowser
- Unable to invoke ExecuteDevToolsMethod on CEF UI Thread.
- settings
- Cef.Shutdown has already been called, it's no longer possibl
- converter
AI-assisted analysis of cefsharp/CefSharp@16bc6e0711 (2026-08-13).
Data as JSON: /api/errors/9fb3175fd939bcd7.
Report an issue: GitHub.