[Solved] Error when trying to use Edge backend for wxWebView

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
fishnet37222
Experienced Solver
Experienced Solver
Posts: 74
Joined: Sat May 06, 2017 1:40 pm

[Solved] Error when trying to use Edge backend for wxWebView

Post by fishnet37222 »

I am trying to use the new Edge back-end for the wxWebView control. I followed the directions listed on the wxWebView documentation page and the library built without any errors. I created a Visual Studio solution and added the WebView2 nuget package to it.

I've verified that "WebView2Loader.dll" is in the same folder as my project's executable after a successful build:
Image

When I try to create a wxWebView control using the Edge back-end, I get the following error message at run-time:

Code: Select all

...wxWidgets-3.1.4\src\msw\webview_edge.cpp(133): 'GetCoreWebView2BrowserVersionInfo' failed with error 0x80070002 (The system cannot find the file specified.).
I'm using the following code to create the control. The error occurs when calling "IsBackendAvailable()".

Code: Select all

wxWebView* webView = nullptr;
if (wxWebView::IsBackendAvailable(wxWebViewBackendEdge))
{
	webView = wxWebView::New(this, wxID_ANY, "about:blank", wxDefaultPosition, wxDefaultSize, wxWebViewBackendEdge);
}
else
{
	webView = wxWebView::New(this, wxID_ANY, "about:blank", wxDefaultPosition, wxDefaultSize, wxWebViewBackendIE);
}
Is there something else I'm missing?
Last edited by fishnet37222 on Wed Nov 04, 2020 1:05 pm, edited 1 time in total.
Dave F.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Error when trying to use Edge backend for wxWebView

Post by ONEEYEMAN »

Hi,
Do you have a backtrace at the time of this crash?

Thank you.
fishnet37222
Experienced Solver
Experienced Solver
Posts: 74
Joined: Sat May 06, 2017 1:40 pm

Re: Error when trying to use Edge backend for wxWebView

Post by fishnet37222 »

The program doesn't crash when calling that function. The function returns false and that message is printed to the Output window. If it had crashed, I would have included the stack-trace in my initial post.
Dave F.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Error when trying to use Edge backend for wxWebView

Post by ONEEYEMAN »

Hi,
OK, sorry for the confusion - this is debug level message indeed.
However, wxWebView::New() is the function from the library. Could you try to debug it and see what is happening?


Thank you.
fishnet37222
Experienced Solver
Experienced Solver
Posts: 74
Joined: Sat May 06, 2017 1:40 pm

Re: Error when trying to use Edge backend for wxWebView

Post by fishnet37222 »

I stepped into the method call that's returning false as you requested. The screenshot below shows the line in the wxWidgets source that I believe is where the failure occurs. However, this is actually my very first time looking into the wxWidgets source code.

Image

It loads the DLL without any errors. The two "wxDL_INIT_FUNC" calls seem to work without any issues. The "if" statement following those two calls also returns true. After I execute the line with the call to "wxGetAvailableCoreWebView2BrowserVersionString", the Locals window shows the variable "hr" having a value of "HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) : The system cannot find the file specified." I've tried stepping into it, but it just steps over it.
Dave F.
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Error when trying to use Edge backend for wxWebView

Post by doublemax »

AFAIK webview2 does not support the "normal" Edge Chromium that is distributed through Windows Update. It requires a "special" preview version. Download and install the "Evergreen Standalone Installer" from here:
https://developer.microsoft.com/en-us/m ... /webview2/

Some background info:
https://docs.microsoft.com/en-us/micros ... stribution
Use the source, Luke!
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Error when trying to use Edge backend for wxWebView

Post by ONEEYEMAN »

Hi,
From the docs:
At runtime you can use wxWebView::IsBackendAvailable() to check if the backend can be used (it will be available if WebView2Loader.dll can be loaded and Edge (Chromium) is installed)
What is IsBackendAvailable() returns?
Is Edge installed on the machine?

Thank you.
fishnet37222
Experienced Solver
Experienced Solver
Posts: 74
Joined: Sat May 06, 2017 1:40 pm

[Solved] Re: Error when trying to use Edge backend for wxWebView

Post by fishnet37222 »

I've solved the problem. I needed one of the non-stable versions of the new Edge installed as mentioned in the Microsoft docs about WebView2: https://docs.microsoft.com/en-us/micros ... rted/win32. After installing the beta version of Edge, the code worked as expected. I already had the stable version of Edge installed.

Maybe the instructions in the manual should be changed to specify that at least the beta version is needed.
Dave F.
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: [Solved] Error when trying to use Edge backend for wxWebView

Post by PB »

Actually, AFAIK the application should not rely on an Edge being installed and instead using its own installer, just as doublemax wrote.
diogom12
Earned a small fee
Earned a small fee
Posts: 24
Joined: Sat Jun 13, 2020 6:07 am

Re: [Solved] Error when trying to use Edge backend for wxWebView

Post by diogom12 »

is that still the case that it needs the beta version? Im trying to use and having the same problem, compiled, dll in the right place but wxWebView::IsBackendAvailable(wxWebViewBackendEdge) returns false every time.

I tried to install the "Evergreen Standalone Installer" , but still didnt work.
diogom12
Earned a small fee
Earned a small fee
Posts: 24
Joined: Sat Jun 13, 2020 6:07 am

Re: [Solved] Error when trying to use Edge backend for wxWebView

Post by diogom12 »

Sorry, it worked, it was my mistake putting the dll in the wrong place
Post Reply