Nithin Paul
Nithin Paul

Reputation: 2199

Facing Cefsharp.BrowserSubprocess has stopped working after cefsharp version update

We have a VB windows application project using Cefsharp to display browser screen to display some data.

As part of Angular upgrade we have migrated our current cefsharp version from 75.1.142 to 98.1.21.

Reason for not updating to latest cefsharp version is when we did the update the application layout is completely affected, font size reduced, controls broken. So we forced to use lower versions.

We used nuget package manager to update the current version.

It is working fine in our local machine, but after deploying the changes to deployment machine we are getting this

Cefsharp.BrowserSubprocess has stopped working
A problem caused the program to stop working...

Please Note: when we compare the .csproj after the update to 98.1.21 we can see that Cefsharp.Winform is now missing in our latest changes under the imported project lists

Please Note: currently we are using cefsharp in our 2 projects and Target Framework used of these 2 projects are 4.6.2

This is what we have in our CefSettings initialization method

Dim settings As CefSettings = New CefSettings()
settings.remotedebuggingport = findafreetcpport()
settings.cefcommandlineargs.add("disable-gpu", "1")
settings.logfile = ceflogfilename
settings.logseverity = logsiviertity.error
cefsharp.cef.initialize(settings)

And my ChromiumBrowser is initialized like this

_chromeBrowser = new ChromiumWebBrowser(url)
_chromeBrowser.JavascriptObjectRepository.Settings.LedgacyBindingEnabled = True
_chromeBrowser.JavascriptObjectRepository.register("bond", new ChromiumWebBrowserEventHandler(Me),True,BindingOptions.DefaultBinder)

Please note: i haven't provided any BrowserSubProcesssPath during my cefsettings

And in my both .csproj files I have this

 <cefsharpanycpusupport>true</cefsharpanycpusupport>

please let me know if you need to know how is my .csproj is configured with cefsharp dll paths.

we also tried different versions but same error is popping out

Any idea why i am facing this problem

Upvotes: 0

Views: 1086

Answers (1)

Nithin Paul
Nithin Paul

Reputation: 2199

Finally after many days of nail biting I managed to solve this problem by doing this steps..

  1. Updated Cefsharp version with Cefsharp 107.1.121 (latest version was affecting our current windows application layouts. So we forced to stick with this version)

  2. Moved LedgacyBindingEnabled = True from my cefsettings to ChromiumWebBrowser initialization section like below

    _chromeBrowser = new ChromiumWebBrowser(url)
    _chromeBrowser.JavascriptObjectRepository.Settings.LedgacyBindingEnabled = True
    _chromeBrowser.JavascriptObjectRepository.register("bond", new 
    ChromiumWebBrowserEventHandler(Me),True,BindingOptions.DefaultBinder)
    
  3. Modified cefsettings section by removing the LedgacyBindingEnabled = True code

  4. Then set this broswersubprocess path to absolute (Important) one like this

     Dim assemblyPath = System.IO.Path.GetDirectoryName(System.reflection.assembly.GetExecutingAssembly.Location)
     If assemblyPath.EndsWith("\") == False Then
        assemblyPath = assemblyPath & "\"
     End If
     Settings.BrowserSubProcesssPath = assemblyPath & 
     "Cefsharp.BrowserSubprocess.exe"
    

Hope it helps to someone who updates ur Angular version and stuck because of CefSharp version change.

Upvotes: 1

Related Questions