Skip to content

Commit a7cc972

Browse files
committed
WPF/OffScreen - NullReferenceException in the WaitForRenderIdleAsync method
- Catch and throw exception back onto the calling thread so it doesn't crash the app Resovles #4902
1 parent 9b99752 commit a7cc972

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

CefSharp.OffScreen/ChromiumWebBrowser.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,10 @@ public async Task WaitForRenderIdleAsync(int idleTimeInMs = 500, TimeSpan? timeo
762762
// the same time, the timer maybe Disposed on a different thread.
763763
// https://github.com/cefsharp/CefSharp/issues/4597
764764
}
765+
catch(Exception ex)
766+
{
767+
renderIdleTcs.TrySetException(ex);
768+
}
765769
};
766770

767771
idleTimer.Start();

CefSharp.Wpf/ChromiumWebBrowser.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2754,6 +2754,10 @@ public async Task WaitForRenderIdleAsync(int idleTimeInMs = 500, TimeSpan? timeo
27542754
// the same time, the timer maybe Disposed on a different thread.
27552755
// https://github.com/cefsharp/CefSharp/issues/4597
27562756
}
2757+
catch (Exception ex)
2758+
{
2759+
renderIdleTcs.TrySetException(ex);
2760+
}
27572761
};
27582762

27592763
idleTimer.Start();

0 commit comments

Comments
 (0)