Skip to content

Commit

Permalink
WPF/OffScreen - NullReferenceException in the WaitForRenderIdleAsync …
Browse files Browse the repository at this point in the history
…method

- Catch and throw exception back onto the calling thread so it doesn't crash the app

Resovles #4902
  • Loading branch information
amaitland committed Aug 21, 2024
1 parent 9b99752 commit a7cc972
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CefSharp.OffScreen/ChromiumWebBrowser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,10 @@ public async Task WaitForRenderIdleAsync(int idleTimeInMs = 500, TimeSpan? timeo
// the same time, the timer maybe Disposed on a different thread.
// https://github.com/cefsharp/CefSharp/issues/4597
}
catch(Exception ex)
{
renderIdleTcs.TrySetException(ex);
}
};

idleTimer.Start();
Expand Down
4 changes: 4 additions & 0 deletions CefSharp.Wpf/ChromiumWebBrowser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2754,6 +2754,10 @@ public async Task WaitForRenderIdleAsync(int idleTimeInMs = 500, TimeSpan? timeo
// the same time, the timer maybe Disposed on a different thread.
// https://github.com/cefsharp/CefSharp/issues/4597
}
catch (Exception ex)
{
renderIdleTcs.TrySetException(ex);
}
};

idleTimer.Start();
Expand Down

0 comments on commit a7cc972

Please sign in to comment.