Click here to Skip to main content
15,749,281 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a WPF Project, in MainWindow.xaml there are 1 grid which contain button, 1 cefsharp ChromiumWebBrowser. When loading window Grid is Visible and ChromiumWebBrowser is Hidden. If I click the button, Grid is Hidden and ChromiumWebBrowser is Visible and ChromiumWebBrowser must open 1 html page.

My project is working perfectly in visual studio. After that I build to .msi file and install it. When run exe file, app open normally but when I click button it will be crash and close immediately. I open file debug.log and see the error No likely focused browser

So anyone can help me to solve this issue? I really appreciate any idea from every one.
Noted: I use VS2022 64 bit and msi file is also x64bit version

What I have tried:

I open event viewer and see another error
Faulting module name: libcef.dll, version:, time stamp: 0x63976dec
Updated 2-Jan-23 23:21pm
Gerry Schmitz 29-Dec-22 10:25am    
Put a try catch block around the "click" code and look at the exception in depth. (and you can't "hide" a grid and still have the "contents" visible; it's not logical).
huynhminh97 29-Dec-22 22:43pm    
Hi @Gerry Schmitz, thanks for your comment. I add try catch for click event and also write log before each code line, but program is run entirely code line without error so catch block is not called. Is it because I "hide" the grid as you said that cause this problem?
What I want now: Open MainWindow in WPF app and click button => display a web page in this window (not open more window) => working with web and send data to WPF => when receive data in WPF side, I want to turn off web page and display MainWindow again. How I can do this?
Gerry Schmitz 30-Dec-22 1:57am    
Use something more people are familiar with; then you'll get more answers; and still accomplish the same thing.
Vivek_Dutta 29-Dec-22 13:07pm    
I think Gerry has a point. But I would also like to add please check if you have .Net 6 runtime installed.
huynhminh97 29-Dec-22 22:46pm    
@Vivek_Dutta, thank you so much. I checked and .Net6 runtime was installed. Do you have another idea about this issue?

It sounds like you are missing a DLL.

Have you compared the DLLs in the Debug and release folders?

When you install, have you compared the install folder DLLs to the other two?

Can you see any differences? You may have to manually include them in your release package. Don't just rely on the package manager.
Share this answer
huynhminh97 2-Jan-23 23:03pm    
Hi @Graeme_Grant, I compare and checked but my installation folder contained all required dependencies as link so I think this error is not missing file
Graeme_Grant 3-Jan-23 1:21am    
It's not what I think that matters, it is what the error message is telling you that matters. I am only giving you my thoughts on what it could be. If it works in dev but not on install, then you are using different dll versions or one is missing. I have given you how I would go through the process of elimination to identify what the issue is.
huynhminh97 3-Jan-23 1:25am    
@Graeme_Grant Tks you so much. I'm trying to solve it and will tell you once I find the solution
I found the reason that cause this issue. See link Could not load file or assembly CefSharp to get detail information
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900