cefsharp/CefSharp · info · OperationCanceledException

Nested Exception Canceled

Error message

Nested Exception Canceled

What it means

The outermost OperationCanceledException thrown by TriggerNestedExceptions() wrapping the InvalidOperationException (which itself wraps the DivisionByZero). It tests that CefSharp correctly flattens/transmits a multi-level exception stack to JavaScript. Not a production error; purely demo/test code.

Source

Thrown at CefSharp.Example/JavascriptBinding/ExceptionTestBoundObject.cs:35

        }

        [DebuggerStepThrough]
        public double TriggerNestedExceptions()
        {
            try
            {
                try
                {
                    return DivisionByZero(0);
                }
                catch (Exception innerException)
                {
                    throw new InvalidOperationException("Nested Exception Invalid", innerException);
                }
            }
            catch (Exception e)
            {
                throw new OperationCanceledException("Nested Exception Canceled", e);
            }
        }

        [DebuggerStepThrough]
        public int TriggerParameterException(int parameter)
        {
            return parameter;
        }

        public void TestCallbackException(IJavascriptCallback errorCallback, IJavascriptCallback errorCallbackResult)
        {
            const int taskDelay = 500;

            Task.Run(async () =>
            {
                await Task.Delay(taskDelay);

                using (errorCallback)

View on GitHub (pinned to 16bc6e0711)

Solutions

  1. Expected in example code — not a real defect.
  2. Remove the example bound object from your project if unwanted.
  3. When designing your own bound objects, prefer a single well-typed exception over deeply nested ones.

Example fix

// JavaScript
try { await boundObj.triggerNestedExceptions(); }
catch (e) { console.log('Outer:', e.message, 'Inner:', e.innerException); }
Defensive patterns

Strategy: try-catch

Try / catch

// In JavaScript
try { await boundObj.triggerNestedExceptions(); }
catch (e) { console.log('Outer:', e.message, 'Inner:', e.innerException); }

Prevention

When it happens

Trigger: Calling bound TriggerNestedExceptions() from JS in the example browser — this is the final exception that reaches the JS catch.

Common situations: Running the example app's exception-handling demo. Not encountered in production unless you reference ExceptionTestBoundObject.

Related errors


AI-assisted analysis of cefsharp/CefSharp@16bc6e0711 (2026-08-13). Data as JSON: /api/errors/69ec640e4292f70e. Report an issue: GitHub.