Skip to content

Commit 154afa3

Browse files
committed
WPF - WritableBitmapRenderHandler ArgumentOutofRange
Resolves #3474
1 parent 12a0045 commit 154afa3

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

CefSharp.Wpf/Rendering/WritableBitmapRenderHandler.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,16 @@ protected override void CreateOrUpdateBitmap(bool isPopup, Rect dirtyRect, IntPt
111111

112112
var bitmap = (WriteableBitmap)image.Source;
113113

114+
//When agressively resizing the ChromiumWebBrowser sometimes
115+
//we can end up with our buffer size not matching our bitmap size
116+
//Just ignore these frames as the rendering should eventually catch up
117+
//(CEF can generate multiple frames before WPF has performed a render cycle)
118+
//https://github.com/cefsharp/CefSharp/issues/3474
119+
if (width > bitmap.PixelWidth || height > bitmap.PixelHeight)
120+
{
121+
return;
122+
}
123+
114124
//By default we'll only update the dirty rect, for those that run into a MILERR_WIN32ERROR Exception (#2035)
115125
//it's desirably to either upgrade to a newer .Net version (only client runtime needs to be installed, not compiled
116126
//against a newer version. Or invalidate the whole bitmap

0 commit comments

Comments
 (0)