cefsharp/CefSharp · error · ArgumentNullException
manager
Error message
manager
What it means
Thrown by the CookieManagerDecorator constructor when the inner ICookieManager passed to it is null. CookieManagerDecorator wraps a real cookie manager and guards access until the underlying CEF cookie store is ready; without a wrapped instance there is nothing to delegate to. The decorator is created internally by CefSharp when providing the per-request-context cookie manager.
Source
Thrown at CefSharp/Internals/CookieManagerDecorator.cs:24
using System.Threading.Tasks;
namespace CefSharp.Internals
{
/// <summary>
/// CookieManager with additional checks to ensure the store is initialized.
/// Throws an exception when attempting to access the store before it's ready.
/// </summary>
public class CookieManagerDecorator : ICookieManager
{
private const string NotInitialziedExceptionMsg = "CookieManager store is not initialized.";
private ICookieManager manager;
private volatile bool managerReady;
internal CookieManagerDecorator(ICookieManager manager, TaskCompletionCallback callback)
{
if (manager == null)
{
throw new ArgumentNullException("manager");
}
if (callback == null)
{
throw new ArgumentNullException("manager");
}
this.manager = manager;
if (callback.Task.Status == TaskStatus.RanToCompletion)
{
managerReady = callback.Task.Result;
}
else
{
callback.Task.ContinueWith(x =>
{
managerReady = x.Result;
});View on GitHub (pinned to 16bc6e0711)
Solutions
- Ensure the ICookieManager instance supplied is non-null; if you obtained it from RequestContext.GetCookieManager, verify the request context is valid and initialized.
- If extending/wrapping CefSharp internals, validate the manager reference before constructing the decorator.
- Check for a CefSharp version mismatch or broken custom factory that yields null managers.
Example fix
// before
var decorator = new CookieManagerDecorator(manager, callback);
// after
if (manager == null) throw new InvalidOperationException("Cookie manager must be created first.");
var decorator = new CookieManagerDecorator(manager, callback); Defensive patterns
Strategy: validation
Validate before calling
if (manager == null)
{
throw new InvalidOperationException("Inner cookie manager is not available; create the request context first.");
}
// internal ctor — only construct through the official CefSharp path Prevention
- Obtain the cookie manager via the official RequestContext.GetCookieManager API.
- Do not reflect into or manually construct CookieManagerDecorator with internal arguments.
- Keep CefSharp assembly versions consistent to avoid internal contract mismatches.
When it happens
Trigger: Internal construction of CookieManagerDecorator with a null manager argument. As an internal ctor this is normally invoked by CefSharp internals (e.g. RequestContext.GetCookieManager path); a null indicates an upstream wiring bug or a custom subclass/factory producing a null manager.
Common situations: Custom RequestContext/cookie-manager integration that constructs or reflects over CookieManagerDecorator incorrectly; version mismatch where an internal contract changed; a null returned from a custom ICookieManager provider being passed through.
Related errors
- Please provide a valid array
- Please provide a valid filePath
- Please provide a valid mimeType
- Unable to load byte[] with length 0.
- converter
AI-assisted analysis of cefsharp/CefSharp@16bc6e0711 (2026-08-13).
Data as JSON: /api/errors/082f7c061b5994a7.
Report an issue: GitHub.