cefsharp/CefSharp · error · ArgumentOutOfRangeException
Argument less than 10.
Error message
Argument less than 10.
What it means
IntegratedMessageLoopBrowserProcessHandler drives CEF's message loop via a WPF DispatcherTimer. The interval (in milliseconds) must be at least 10; anything lower would flood the dispatcher with DoMessageLoopWork calls, starving the UI thread and destabilizing CEF's internal timing.
Source
Thrown at CefSharp.Wpf/HwndHost/Handler/IntegratedMessageLoopBrowserProcessHandler.cs:52
private int interval;
/// <summary>
/// Default constructor
/// </summary>
/// <param name="dispatcher">WPF Dispatcher</param>
/// <param name="dispatcherPriority">Priority at which <see cref="Cef.DoMessageLoopWork"/> is called using the Dispatcher</param>
/// <param name="interval">the <see cref="Timer.Interval"/> in miliseconds (frame rate), for 30/60 times per second use
/// <see cref="ThirtyTimesPerSecond"/>/<see cref="SixtyTimesPerSecond"/> respectively.</param>
public IntegratedMessageLoopBrowserProcessHandler(Dispatcher dispatcher, DispatcherPriority dispatcherPriority = DispatcherPriority.Render, int interval = ThirtyTimesPerSecond)
{
if (dispatcher == null)
{
throw new ArgumentNullException(nameof(dispatcher));
}
if (interval < 10)
{
throw new ArgumentOutOfRangeException(nameof(interval), "Argument less than 10. ");
}
dispatcherTimer = new DispatcherTimer(dispatcherPriority, dispatcher)
{
Interval = TimeSpan.FromMilliseconds(interval)
};
dispatcherTimer.Tick += OnDispatcherTimerTick;
dispatcherTimer.Start();
this.dispatcher = dispatcher;
this.dispatcher.ShutdownStarted += DispatcherShutdownStarted;
this.dispatcherPriority = dispatcherPriority;
this.interval = interval;
Cef.ShutdownStarted += OnCefShutdownStarted;
}
View on GitHub (pinned to 16bc6e0711)
Solutions
- Use the provided constants ThirtyTimesPerSecond (≈33ms) or SixtyTimesPerSecond (≈16ms).
- If a custom interval is needed, ensure it is >= 10.
- Validate the interval before passing it.
Example fix
// before — too low
var handler = new IntegratedMessageLoopBrowserProcessHandler(dispatcher, DispatcherPriority.Render, 5);
// after — use a safe constant or validate
var handler = new IntegratedMessageLoopBrowserProcessHandler(
dispatcher, DispatcherPriority.Render,
IntegratedMessageLoopBrowserProcessHandler.SixtyTimesPerSecond); Defensive patterns
Strategy: validation
Validate before calling
const int minInterval = 10;
if (interval < minInterval)
{
throw new ArgumentOutOfRangeException(nameof(interval),
$"Interval must be >= {minInterval}ms, got {interval}");
}
var handler = new IntegratedMessageLoopBrowserProcessHandler(dispatcher, priority, interval); Prevention
- Use the built-in constants ThirtyTimesPerSecond or SixtyTimesPerSecond.
- Never pass a computed interval without clamping it to >= 10.
- Document the minimum interval constraint in your configuration UI.
When it happens
Trigger: Passing an interval value less than 10 to the constructor's interval parameter (default is ThirtyTimesPerSecond ≈ 33ms).
Common situations: Trying to achieve a higher frame rate than 100fps by passing a very small interval. Passing 0 or 1 by mistake (e.g. a computed value from an uninitialized variable).
Related errors
- Browser has already been created. BrowserSettings must be se
- Browser has already been created. RequestContext must be set
- viewPort.Scale must be greater than 0.
- {prop.Name} is required
- otherRequestContext
AI-assisted analysis of cefsharp/CefSharp@16bc6e0711 (2026-08-13).
Data as JSON: /api/errors/29af44c39897fb20.
Report an issue: GitHub.