Welcome Guest Search | Active Topics | Sign In | Register

webview capture throws exception occasionally on wpf project Options
LandTrack Support
Posted: Tuesday, October 30, 2018 4:12:34 AM
Rank: Newbie
Groups: Member

Joined: 7/3/2017
Posts: 8
Hi
We have a WPF app and a 'dashcam' taking screen shots every 100 ms or so. Occasionally we get the exception :


TakePhoto Exception at frame 57:

System.ArgumentException: Parameter is not valid.
at System.Drawing.Bitmap..ctor(Int32 width, Int32 height, PixelFormat format)
at EO.WebBrowser.WebView.a(IntPtr A_0, Int32 A_1, Int32 A_2)
at EO.WebBrowser.WebView.b(IntPtr A_0, Int32 A_1, Int32 A_2)
at EO.WebBrowser.WebView.Capture(Rectangle srcRect, Size targetSize)
at EO.WebBrowser.WebView.Capture(Rectangle srcRect)
at EO.WebBrowser.WebView.Capture(Boolean excludeScrollBars)
at EO.WebBrowser.WebView.Capture()
at ScrapeLib.DashCam.TakePhoto(WebView webView)

We thought it was a startup issue, but turns out its not as its taken 57 frames successfully. Code is:


if (!webView.IsReady || !webView.IsCreated)
{
Trace.WriteLine($"No Photo IsReady={webView.IsReady} IsCreated={webView.IsCreated}");
return;
}
try
{
var pic = webView.Capture();


Trace Log:
first two frames get:

No Photo IsReady=False IsCreated=False
No Photo IsReady=False IsCreated=True

Is there anything else we can test for to avoid the exception?

Thanks

Justin

eo_support
Posted: Thursday, November 1, 2018 8:30:27 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,221
Hi,

This usually indicates a low memory issue. Please check to make sure you call Dispose of the returned Image object. If that still does not work, you may want to reduce the frame rate.

Thanks!
LandTrack Support
Posted: Thursday, November 1, 2018 10:34:49 PM
Rank: Newbie
Groups: Member

Joined: 7/3/2017
Posts: 8
Thanks, I'll give that a try.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.