{"record":{"id":"29af44c39897fb20","repo":"cefsharp/CefSharp","slug":"argument-less-than-10","errorCode":null,"errorMessage":"Argument less than 10. ","messagePattern":"Argument less than 10\\. ","errorType":"validation","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"CefSharp.Wpf/HwndHost/Handler/IntegratedMessageLoopBrowserProcessHandler.cs","lineNumber":52,"sourceCode":"        private int interval;\n\n        /// <summary>\n        /// Default constructor\n        /// </summary>\n        /// <param name=\"dispatcher\">WPF Dispatcher</param>\n        /// <param name=\"dispatcherPriority\">Priority at which <see cref=\"Cef.DoMessageLoopWork\"/> is called using the Dispatcher</param>\n        /// <param name=\"interval\">the <see cref=\"Timer.Interval\"/> in miliseconds (frame rate), for 30/60 times per second use\n        /// <see cref=\"ThirtyTimesPerSecond\"/>/<see cref=\"SixtyTimesPerSecond\"/> respectively.</param>\n        public IntegratedMessageLoopBrowserProcessHandler(Dispatcher dispatcher, DispatcherPriority dispatcherPriority = DispatcherPriority.Render, int interval = ThirtyTimesPerSecond)\n        {\n            if (dispatcher == null)\n            {\n                throw new ArgumentNullException(nameof(dispatcher));\n            }\n\n            if (interval < 10)\n            {\n                throw new ArgumentOutOfRangeException(nameof(interval), \"Argument less than 10. \");\n            }\n\n            dispatcherTimer = new DispatcherTimer(dispatcherPriority, dispatcher)\n            {\n                Interval = TimeSpan.FromMilliseconds(interval)\n            };\n\n            dispatcherTimer.Tick += OnDispatcherTimerTick;\n            dispatcherTimer.Start();\n\n            this.dispatcher = dispatcher;\n            this.dispatcher.ShutdownStarted += DispatcherShutdownStarted;\n            this.dispatcherPriority = dispatcherPriority;\n            this.interval = interval;\n\n            Cef.ShutdownStarted += OnCefShutdownStarted;\n        }\n","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/cefsharp/CefSharp/blob/16bc6e0711a4945be17e8bc4bc7ccf9469f3fdec/CefSharp.Wpf/HwndHost/Handler/IntegratedMessageLoopBrowserProcessHandler.cs#L34-L70","documentation":"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.","triggerScenarios":"Passing an interval value less than 10 to the constructor's interval parameter (default is ThirtyTimesPerSecond ≈ 33ms).","commonSituations":"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).","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."],"exampleFix":"// before — too low\nvar handler = new IntegratedMessageLoopBrowserProcessHandler(dispatcher, DispatcherPriority.Render, 5);\n\n// after — use a safe constant or validate\nvar handler = new IntegratedMessageLoopBrowserProcessHandler(\n    dispatcher, DispatcherPriority.Render,\n    IntegratedMessageLoopBrowserProcessHandler.SixtyTimesPerSecond);","handlingStrategy":"validation","validationCode":"const int minInterval = 10;\nif (interval < minInterval)\n{\n    throw new ArgumentOutOfRangeException(nameof(interval),\n        $\"Interval must be >= {minInterval}ms, got {interval}\");\n}\nvar handler = new IntegratedMessageLoopBrowserProcessHandler(dispatcher, priority, interval);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["message-loop","timer","validation","wpf-hwndhost"],"backgroundTag":null,"analyzedSha":"16bc6e0711a4945be17e8bc4bc7ccf9469f3fdec","analyzedAt":"2026-08-13T19:57:05.828Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}