{"record":{"id":"082f7c061b5994a7","repo":"cefsharp/CefSharp","slug":"manager","errorCode":null,"errorMessage":"manager","messagePattern":"manager","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"CefSharp/Internals/CookieManagerDecorator.cs","lineNumber":24,"sourceCode":"using System.Threading.Tasks;\n\nnamespace CefSharp.Internals\n{\n    /// <summary>\n    /// CookieManager with additional checks to ensure the store is initialized.\n    /// Throws an exception when attempting to access the store before it's ready.\n    /// </summary>\n    public class CookieManagerDecorator : ICookieManager\n    {\n        private const string NotInitialziedExceptionMsg = \"CookieManager store is not initialized.\";\n        private ICookieManager manager;\n        private volatile bool managerReady;\n\n        internal CookieManagerDecorator(ICookieManager manager, TaskCompletionCallback callback)\n        {\n            if (manager == null)\n            {\n                throw new ArgumentNullException(\"manager\");\n            }\n            if (callback == null)\n            {\n                throw new ArgumentNullException(\"manager\");\n            }\n\n            this.manager = manager;\n\n            if (callback.Task.Status == TaskStatus.RanToCompletion)\n            {\n                managerReady = callback.Task.Result;\n            }\n            else\n            {\n                callback.Task.ContinueWith(x =>\n                {\n                    managerReady = x.Result;\n                });","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/cefsharp/CefSharp/blob/16bc6e0711a4945be17e8bc4bc7ccf9469f3fdec/CefSharp/Internals/CookieManagerDecorator.cs#L6-L42","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nvar decorator = new CookieManagerDecorator(manager, callback);\n\n// after\nif (manager == null) throw new InvalidOperationException(\"Cookie manager must be created first.\");\nvar decorator = new CookieManagerDecorator(manager, callback);","handlingStrategy":"validation","validationCode":"if (manager == null)\n{\n    throw new InvalidOperationException(\"Inner cookie manager is not available; create the request context first.\");\n}\n// internal ctor — only construct through the official CefSharp path","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["cookie-manager","validation","null-reference","constructor","cefsharp"],"backgroundTag":null,"analyzedSha":"16bc6e0711a4945be17e8bc4bc7ccf9469f3fdec","analyzedAt":"2026-08-13T19:57:05.828Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}