Search code examples
vb.netchromiumchromium-embeddedcefsharp

CefSharp application launch initialize problems


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.


Solution

  • 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("")