by a1dharm » Wed Dec 22, 2021 5:53 am
Hi @amaitland
Ok, Now, team decided to applied cefsharp upgrading step by step( from 71 to 73 to 75 to 79 to 81....). so that we can identify cefsharp version wise changes and what will effect for our application.
As of now we have upgraded with 73 and 75 successfully there is no issue. but after upgraded with 79, Sometimes getting issue browser initialized issue i.e "The ChromiumWebBrowser instance creates the underlying Chromium Embedded Framework (CEF) browser instance in an async fashion." . That issue causing when show() the browser after the browser intialization. We have checked in cef 79, the only javascript object registration was changed for my project.
Earlier it was
CefSharpSettings.LegacyJavascriptBindingEnabled = true;
var jsWrapper = new JsWrapper(Wrapper.Instance, name);
browser.RegisterAsyncJsObject("metis", jsWrapper, new CefSharp.BindingOptions() { CamelCaseJavascriptNames = false });
browser.RegisterAsyncJsObject("TcFiles", Wrapper.MultipartFormUpload.Instance);
Now In Cefsharp 79
CefSharpSettings.LegacyJavascriptBindingEnabled = true;
var jsWrapper = new JsWrapper(Wrapper.Instance, name);
browser.JavascriptObjectRepository.Register("metis", jsWrapper, isAsync: true, options: new BindingOptions() { CamelCaseJavascriptNames = false });
browser.JavascriptObjectRepository.Register("TcFiles", Wrapper.MultipartFormUpload.Instance, isAsync: true);
Error
[34 2021-12-21 12:35:28.185] <E/Application> Exception:The ChromiumWebBrowser instance creates the underlying Chromium Embedded Framework (CEF) browser instance in an async fashion. The undelying CefBrowser instance is not yet initialized. Use the IsBrowserInitializedChanged event and check the IsBrowserInitialized property to determine when the browser has been initialized., stack: at CefSharp.Wpf.ChromiumWebBrowser.GetBrowser() in C:\projects\cefsharp\CefSharp.Wpf\ChromiumWebBrowser.cs:line 2764
at mobile.ChromiumWebBrowserCustom.DoSize(Size size) in C:\xxx\xxx\projects\win10\project\ChromiumWebBrowserCustom.cs:line 83
at mobile.ChromiumWebBrowserCustom.OnActualSizeChanged(Object sender, SizeChangedEventArgs e) in C:\xxx\xxx\projects\win10\project\ChromiumWebBrowserCustom.cs:line 68
at System.Windows.SizeChangedEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
at System.Windows.FrameworkElement.OnRenderSizeChanged(SizeChangedInfo sizeInfo)
at System.Windows.ContextLayoutManager.fireSizeChangedEvents()
at System.Windows.ContextLayoutManager.UpdateLayout()
at System.Windows.UIElement.UpdateLayout()
at System.Windows.Interop.HwndSource.SetLayoutSize()
at System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value)
at System.Windows.Interop.HwndSource.set_RootVisual(Visual value)
at System.Windows.Window.SetRootVisual()
at System.Windows.Window.SetRootVisualAndUpdateSTC()
at System.Windows.Window.SetupInitialState(Double requestedTop, Double requestedLeft, Double requestedWidth, Double requestedHeight)
at System.Windows.Window.CreateSourceWindow(Boolean duringShow)
at System.Windows.Window.CreateSourceWindowDuringShow()
at System.Windows.Window.SafeCreateWindowDuringShow()
at System.Windows.Window.ShowHelper(Object booleanBox)
at System.Windows.Window.Show()
at mobile.BrowserWindow.<>c__DisplayClass106_0.<ShowWindow>b__0() in C:\xxx\xxx\projects\win10\project\BrowserWindow.cs:line 976
at System.Windows.Threading.Dispatcher.Invoke(Action callback, DispatcherPriority priority, CancellationToken cancellationToken, TimeSpan timeout)
at System.Windows.Threading.Dispatcher.Invoke(Action callback)
at mobile.BrowserWindow.ShowWindow(Boolean activate) in C:\xxx\xxx\projects\win10\project\BrowserWindow.cs:line 974
at mobile.MainWindow.init(Dictionary`2 jsObjects, String request) in C:\xxx\xxx\projects\win10\project\MainWindow.cs:line 203
at mobile.Wrapper.initMainWindow(String request) in C:\xxx\xxx\projects\win10\project\Wrapper.cs:line 109
at mobile.Wrapper.init(String request) in C:\xxx\xxx\projects\win10\project\Wrapper.cs:line 89
at mobile.App.<>c__DisplayClass15_0.<Application_Startup>b__0() in C:\xxx\xxx\projects\win10\project\App.xaml.cs:line 484
at System.Windows.Threading.Dispatcher.Invoke(Action callback, DispatcherPriority priority, CancellationToken cancellationToken, TimeSpan timeout)
at System.Windows.Threading.Dispatcher.Invoke(Action callback)