Problem with global static attribute: Cef.IsInitialize #5041
Replies: 1 comment
-
Converting to discussion as I believe it's working as intended. A new issue can be created if code changes are required.
That sounds like the expected behavior to me. You need to implement
If You can use
It's up to you to implement this behavior in your application. You can use |
Beta Was this translation helpful? Give feedback.
-
Is there an existing issue for this?
CefSharp Version
131.3.50
Operating System
Windows 10
Architecture
x64
.Net Version
.Net Framework 4.8
Implementation
WinForms
Reproduction Steps
Problem with global static attribute: Cef.IsInitialize:
When I was using the old version [109.1.110], I used multiple exe clients that worked, but after updating to the new version [131.1.50], I made some code changes:
Change 'if (! Cef. IsInitialize d)' to 'if (! Cef. IsInitialize d. HasValue | |! Cef. IsInitialize d. Value)'
When I open multiple exe clients, the error message is as follows:
Cef.Initialize can only be called once per process. This is a limitation of the underlying CEF/Chromium framework. You can change many (not all) settings at runtime through RequestContext.SetPreference. See https://github.com/cefsharp/CefSharp/wiki/General-Usage#request -context-browser-isolation Use Cef. IsInitialized to check if Cef.Initialize has already been called to avoid this exception. If you are seeing this unexpectedly then you are likely calling Cef.Initialize after you've created an instance of ChromiumWebBrowser, it must be called before the first instance is created.
From the error message above, it can be seen that the new version [131.1.50] seems to have Cef. every time a new client is executed IsInitialize will be null, causing the execution of the 'Cef. Initialize (settings, performanDependency Check: true, browserProcessHandler: null)' code after the 'if' code to be re executed
Expected behavior
When I want to open multiple clients (exe programs), only one initialization will be performed. Cef.IsInitialize will only execute the following code if the first client checks as fasle and all other clients are true:
Cef.Initialize(settings, performDependencyCheck: true, browserProcessHandler: null);
Actual behavior
When each client is first opened, CefIsInitialize is false, causing CefSharp to initialize multiple times
Regression?
No response
Known Workarounds
No response
Does this problem also occur in the CEF Sample Application
Yes using WPF/OffScreen command line args
Other information
No response
Beta Was this translation helpful? Give feedback.
All reactions