Skip to content

Commit e8ac112

Browse files
committed
WinForms - OnHandleDestroyed directly references CefSharp.Core crashing Designer
Designer attempts to load CefSharp.Core.dll which in fails, we avoid that when designMode is true Resolves #3219
1 parent 8c511a0 commit e8ac112

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

CefSharp.WinForms/ChromiumWebBrowser.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,18 @@ protected override void OnHandleCreated(EventArgs e)
672672
}
673673

674674
protected override void OnHandleDestroyed(EventArgs e)
675+
{
676+
if (!designMode)
677+
{
678+
// NOTE: Had to move the code out of this function otherwise the designer would crash
679+
OnHandleDestroyedInternal();
680+
}
681+
682+
base.OnHandleDestroyed(e);
683+
}
684+
685+
[MethodImpl(MethodImplOptions.NoInlining)]
686+
private void OnHandleDestroyedInternal()
675687
{
676688
//When the Control is being Recreated then we'll park
677689
//the browser (set to a temp parent) and assign to
@@ -686,8 +698,6 @@ protected override void OnHandleDestroyed(EventArgs e)
686698

687699
NativeMethodWrapper.SetWindowParent(hwnd, parkingControl.Handle);
688700
}
689-
690-
base.OnHandleDestroyed(e);
691701
}
692702

693703
/// <summary>

0 commit comments

Comments
 (0)