cefsharp / CefSharp

.NET (WPF and Windows Forms) bindings for the Chromium Embedded Framework
http://cefsharp.github.io/
Other
9.89k stars 2.92k forks source link

Wpf Example crashes on Resize #95

Closed leepa closed 11 years ago

leepa commented 11 years ago

Download latest binary release. Resize horizontally and back a few times without lifting the mouse button.

You'll crash.

System.Reflection.TargetInvocationException was unhandled
  HResult=-2146232828
  Message=Exception has been thrown by the target of an invocation.
  Source=mscorlib
  StackTrace:
       at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
       at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
       at System.Delegate.DynamicInvokeImpl(Object[] args)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.DispatcherOperation.InvokeImpl()
       at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Windows.Threading.DispatcherOperation.Invoke()
       at System.Windows.Threading.Dispatcher.ProcessQueue()
       at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
       at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
  InnerException: System.Runtime.InteropServices.COMException
       HResult=-2147024890
       Message=The handle is invalid. (Exception from HRESULT: 0x80070006 (E_HANDLE))
       Source=PresentationCore
       ErrorCode=-2147024890
       StackTrace:
            at System.Windows.Interop.InteropBitmap..ctor(IntPtr section, Int32 pixelWidth, Int32 pixelHeight, PixelFormat format, Int32 stride, Int32 offset)
            at System.Windows.Interop.Imaging.CreateBitmapSourceFromMemorySection(IntPtr section, Int32 pixelWidth, Int32 pixelHeight, PixelFormat format, Int32 stride, Int32 offset)
            at CefSharp.Wpf.WebView.SetBitmap()
       InnerException: 
codeus-de commented 11 years ago

This also happens when you include a new WebView in an empty WPF window. Even when no document / URL is loaded the application will crash after some window resizes.

ataranto commented 11 years ago

Thanks. I think this will be fixed by some of the work that people have done to fix some coordinate mappings that were problematic in the offscreen rendereing mechanism. i am going to merge/test fixes for this during the week.

see here for example, there are a few more fixes in other forks as well:

https://github.com/Icenium/CefSharp/commit/9a201abda8326e77a884f3ee84c6237519b66d29

ataranto commented 11 years ago

merged that change above, can't repro with the v25 build. please reopen if you see this with the upcoming v25 based release