cefsharp/CefSharp · info · Exception
Expected Exception
Error message
Expected Exception
What it means
Thrown by AsyncBoundObject.AsyncThrowException() after a 2-second delay — example/test code that demonstrates how async C# methods propagate exceptions to JavaScript. Marked [DebuggerHidden] so Visual Studio does not break on it. Not a production error; it exists to exercise the async-exception bridge.
Source
Thrown at CefSharp.Example/JavascriptBinding/AsyncBoundObject.cs:257
}
public async Task<string[]> AsyncDownloadFileAndSplitOnNewLines(string url)
{
var webClient = new WebClient();
var download = await webClient.DownloadStringTaskAsync(new Uri(url));
var lines = download.Split('\n').Where(x => !string.IsNullOrEmpty(x.Trim())).ToArray();
return lines;
}
//We expect an exception here, so tell VS to ignore
[DebuggerHidden]
public async Task<string> AsyncThrowException()
{
await Task.Delay(2000);
throw new Exception("Expected Exception");
}
public uint UIntAddModel(UIntAddModel model)
{
return model.ParamA + model.ParamB;
}
public uint UIntAdd(uint paramA, uint paramB)
{
return paramA + paramB;
}
public async Task<string> JavascriptOptionalCallbackEvalPromise(bool invokeCallback, string msg, IJavascriptCallback callback)
{
using (callback)
{
if (invokeCallback)
{View on GitHub (pinned to 16bc6e0711)
Solutions
- Expected in example code — not a real defect.
- If copied into your app, remove the method or wrap your JS caller in try/catch.
- For your own async bound methods, ensure exceptions are intentional and documented.
Example fix
// JavaScript
try { await asyncBoundObj.asyncThrowException(); }
catch (e) { console.log('Handled:', e.message); } Defensive patterns
Strategy: try-catch
Try / catch
// In JavaScript
try { await asyncBoundObj.asyncThrowException(); }
catch (e) { console.log('Handled:', e.message); } Prevention
- Treat as expected demo behavior.
- Remove from production if unwanted.
- Wrap JS-bound async calls in try/catch.
When it happens
Trigger: Calling the bound asyncThrowException method from JavaScript in the example browser. Only present in CefSharp.Example.
Common situations: Running the example app's test page. Not encountered unless you reference AsyncBoundObject.
Related errors
AI-assisted analysis of cefsharp/CefSharp@16bc6e0711 (2026-08-13).
Data as JSON: /api/errors/ebe04cdb8923c5a1.
Report an issue: GitHub.