-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CoreWebView2Environment.GetAvailableBrowserVersionString() fails in .744 Package #1133
Comments
This seems to be a much bigger problem actually... Any versions past 705 seem to have completely broken the WebView2 initialization sequence. Ignoring the runtime mismatch issues for a moment I installed the latest Dev Canary build and then installed both the 805 and 774 runtimes. Both of them fail in this initialization code by never returning from the call to // ctor called from wrapper (user) control's ctor
public WebViewPreviewHandler(WebView2 webViewBrowser)
{
WebBrowser = webViewBrowser;
// externalize so we can use async in the method
_ = InitializeAsync();
}
async Task InitializeAsync()
{
// must create a data folder if running out of a secured folder that can't write like Program Files
var browserFolder = Path.Combine(mmApp.Configuration.CommonFolder, "WebView_Browser");
var env = await CoreWebView2Environment.CreateAsync(
userDataFolder: browserFolder
);
// 774 and 805 never return from this - so initialization code never gets fired
// it works fine in 705 and earlier
await WebBrowser.EnsureCoreWebView2Async(env);
WebBrowser.NavigationCompleted += WebBrowser_NavigationCompleted;
if (Model.Configuration.System.ShowDeveloperToolsOnStartup)
WebBrowser.CoreWebView2.OpenDevToolsWindow();
// Set up interop object to pass into JavaScript
DotnetInterop = new WebViewPreviewDotnetInterop(Model, WebBrowser);
JsInterop = DotnetInterop.JsInterop;
WebBrowser.CoreWebView2.AddHostObjectToScript("mm", DotnetInterop);
} Any ideas why this is hanging? |
Hey @RickStrahl - thanks for the bug report! I'm guessing these all stem from the same "Unable to load DLL webview2loader.dll". Are you running your code in VS when this happens, or deploying it? What is your project type? If you are trying to build "AnyCPU", can you try building "x64" or "x86"? If that resolves it, then it's likely you need to set a Currently if |
We are looking at a general fix for this issue as part of #730 - class library projects are an example where the isn't set by default. |
Hmmm... odd behavior. Tried your suggestion and it's working when explicitly switching to a platform target (x86) in both the class library that hosts the control and the root project (WPF). Curious that this worked, I then switched back - first the class lib, the the full project back to the Then I removed the explicit runtime and left my Dev Canary build in place and that too worked. Then went back to basically where was (rolled back code, uninstalled Canary, reinstalled .774 runtime) - and the thing still worked. I have no idea what the heck was going on before, but it was failing reliably with .774 and later runtimes and .774 and later libs. But it seems I'm not the only one seeing this library load error so... IAC for now closing since I can't repro any more. |
I'm using
CoreWebView2Environment.GetAvailableBrowserVersionString()
to check for installed browser runtime versions at runtime. In previous builds this has worked fine but after updating to the latest .NET NuGet package:When I call
GetAvailableBrowserVersionString()
I get this error:Unable to load DLL
WebView2Loader.dll
Going back to:
works.
I've got the the latest, released
89.0.744.63
evergreen runtime installed.Additional Notes
In my application I try to figure out what runtime is installed if any. If it is I check for the build number and if the build number of the installed runtime is greater than the build number of CoreWebView2 I presume we're good to go (see code in screenshot). Considering that runtimes seem to be forward compatible - is this is a reasonable approach?
In this case the runtime is the same build number (so should pass) but it looks like this is a breaking change in the WebView2 package...
The text was updated successfully, but these errors were encountered: