0

I have this code in my application to initialize CefSharp:

If (CefSharp.Cef.IsInitialized = False) Then
    Dim settings As New CefSettings()
    settings.CachePath = Application.StartupPath & "\session"
    CefSharp.Cef.Initialize(settings)
    MsgBox("done")
End If

I have been trying for 2 days now but the app never shows "done" when it starts. I was hoping that everytime my application starts it will show this message.

But it does not. The above code is in my main form load event. I call CefSharp shutdown in form closing event to make sure everything exits.

Shouldn't it show that message everytime my app starts? I want to re-initialize cef based on different settings but it does not initialize like eve.

Maybe some process is running which is preventing this?

Please let me know.

Equalsk
  • 7,954
  • 2
  • 41
  • 67
xhammer
  • 145
  • 2
  • 12
  • you have to specify `settings.BrowserSubprocessPath`, path to CefSharp.BrowserSubprocess.exe file. – Amogh Aug 30 '17 at 18:19
  • not working. It's just not showing that message "done". Also if I initialize without checking whether isinitialized is true, it shows an error that it can be initialized only once. I think some process from previous execution is running. – xhammer Aug 31 '17 at 02:12
  • `CefSharp.Cef.Initialize(settings)` what is return value of this? – Amogh Aug 31 '17 at 07:32
  • can't find out. Execution does not go inside that if block. CefSharp.Cef.IsInitialized is always true (even after closing app and restarting it) – xhammer Aug 31 '17 at 07:53
  • Are you initializing cef in `main()` – Amogh Aug 31 '17 at 08:03
  • tried that still nothing. Right now it is in user control which gets added to main form when clicking on a button. I tried on main form load event too but still nothing. – xhammer Aug 31 '17 at 08:15
  • No!! I am asking you that are you initializing in `main()` (Program.cs) also? – Amogh Aug 31 '17 at 12:30
  • nope. It is a vb.net app and I am only initializing in main form_load event. Should I do it in main() ? – xhammer Aug 31 '17 at 14:56

1 Answers1

1

alright so I was creating a chromiumwebbrowser variable in a class file (which I think was getting executed before main form load event) and hence my browser was not getting initialized. Feel so stupid for this. Just commented it and now everything seems to be fine.

'metavariableclass.vb
'Public Shared brw As New ChromiumWebBrowser("")
xhammer
  • 145
  • 2
  • 12