From 5e91d298a51ae7cefde6a3b918dfeb3ff15248b0 Mon Sep 17 00:00:00 2001 From: Mitch Capper Date: Tue, 22 Oct 2024 23:13:36 -0700 Subject: [PATCH] Fix: Allow any RequestContext that inherits from Core.RequestContext Matches non HwndHost check --- CefSharp.Wpf.HwndHost/ChromiumWebBrowser.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CefSharp.Wpf.HwndHost/ChromiumWebBrowser.cs b/CefSharp.Wpf.HwndHost/ChromiumWebBrowser.cs index aff6bd0..32d4498 100644 --- a/CefSharp.Wpf.HwndHost/ChromiumWebBrowser.cs +++ b/CefSharp.Wpf.HwndHost/ChromiumWebBrowser.cs @@ -250,9 +250,9 @@ public IRequestContext RequestContext throw new Exception("Browser has already been created. RequestContext must be " + "set before the underlying CEF browser is created."); } - if (value != null && value.GetType() != typeof(RequestContext)) + if (value != null && !Core.ObjectFactory.RequestContextType.IsAssignableFrom(value.UnWrap().GetType())) { - throw new Exception(string.Format("RequestContxt can only be of type {0} or null", typeof(RequestContext))); + throw new Exception(string.Format("RequestContext can only be of type {0} or null", Core.ObjectFactory.RequestContextType)); } requestContext = value; }