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
Regression: DllNotFoundException: Unable to load DLL 'WebView2Loader.dll' #2372
Comments
The best way to debug this is to repro the issue with procmon running and capturing file system activities. The captured events should tell us where the code tries to find the dll. |
Thanks! We'll try it and report back. |
Thanks @LiangTheDev , it is clearer now where the loading logic is looking for the WebView2Loader.dll, and what behavior has changed between the working SDK (1.0.1072.54) and the non-working SDK (1.0.1108.44). First a little background: since we're talking about a VSTO add-in running under Excel, there are two interesting folders for the add-in .DLLs and their dependencies:
With that as background, here is what we observed using Process Monitor as the difference between the working and non-working cases: Non-working: This is a breaking change for us, we are unable to upgrade to a new SDK until this is fixed. Footnote: As reported, we don't see the issue (WebView2Loader not found) on all test machines. We discovered that the machines where this issue is reproducible do not have Microsoft/Office 365, instead they have a non-subscription installation of Office. On the MS/Office 365 machines, a version of WebView2Loader is found under C:\Program Files\Microsoft Office\root\Office16, so we're just lucking out that that .DLL is on the search path. This is not desirable, since we want to do all of our testing with a known SDK and with a known WebView2Loader.dll, and so don't want to use some other WebView2Loader.dll. |
Hello Shaun, |
While there might be workaround to put the loader dll at a place that we know it will be searched for from the procmon output. This seems to be a regression. I've opened internal tracking issue for this. |
Thanks for all of the details and context that you provided, it's very helpful. I'm checking into this issue and I suspect that I've located the cause of the regression. Could you please help me verify by checking what |
Hi @AndyT-MS - |
We have a fix for this issue currently in a pull request. Thanks! |
@champnic I don't have visibility into the progress of this issue AB#39143740, but I am hoping that the fix will appear soon in an official release, since we are blocked from updating our WV2 SDK until then. |
I just confirmed that the issue still exists using SDK 1.0.1245.22. |
@ShaunLoganOracle There's a new API for explicitly setting the loader path. Can you try using that in the meantime? Apologies the other fix has gotten bogged down and isn't available yet. |
EDIT: if I set the LoaderDllFolderPath before invoking any SDK API (including @champnic Thanks for the pointer to this new property. I have tried setting this static property early on and it does not appear to control which WebView2Loader.dll gets loaded (for me). Recall that my code runs as an an add-in inside of Excel. When I use Process Explorer and watch the Excel.exe process, I can trigger the WV2 initialization in my add-in and I see that WebView2Loader.dll gets loaded from
Here's how I compute the loader folder path for testing this new property, which points at the folder containing the WebView2Loader.dll that I package with my add-in:
When running in the debugger from VS2019, I the folder path returned is something like: Is this the correct usage for this property? |
Yes - in an add-in scenario it's possible for multiple WebView2Loader.dll's to get loaded. Has this caused a problem so far? In a non-add-in scenario, I would expect it to load from that one location. The fix for the underlying issue in finding the correct path got checked in last week, but unfortunately just missed the cutoff for the prerelease SDK. It should be in the following one. Thanks! |
We are not sure, but ideally we'd be able to control which WebView2Loader.dll is used when we spin up a WebView2, in order to be confident that what we've tested before shipping is what the customer will see. |
I kept looking at using the new However, after fixing that and setting
My calling code passes null for |
I wonder if there's a bitness mismatch - is the process and your addin running as x86 or x64? The WebView2Loader.dll is architecture specific. |
|
from @champnic :
Yes, I have (finally) confirmed on our test machines where we were encountering the regression, that using SDK 1.0.1245.22 and setting |
When should we expect to see this fix in a non-prerelease SDK? An estimate will help us plan our next steps. Thanks! |
It should be in prerelease SDK around early August, and release SDK around early September. |
Confirmed the fix in SDK 1.0.1340-prerelease. Looking forward to getting it in the next stable SDK so we can upgrade and get all the fixes and features added since 1.0.902.49. |
Hello @champnic ... I'm having the same problem than @ShaunLoganOracle. In my case is a Word VSTO add-ins (WPF). I follow this thread and I try to solve the issue by using CoreWebView2Environment.LoaderDllFolderPath property... I only have this problem with some users (mostly users NOT using a subscription based Office). |
Hey @VesterT - Looks like the functionality changed from a property to a function: |
Additionally, the fix for the underlying issue is now in 1.0.1340-prerelease SDK, and should be available in the following release SDK. Thanks! |
Description
We started getting a failure to load WebView2Loader.dll when we upgraded the WV2 SDK from 1.0.902.49 to 1.0.1108.44. The DllNotFoundException comes when we call
Microsoft.Web.WebView2.Core.CoreWebView2Environment.GetAvailableBrowserVersionString()
- before doing anything else with WV2. The same solution and code works as expected with 1.0.902.49 but fails after upgrading to 1.0.1108.44 (with no other changes).Stack
Version
SDK: 1.0.902.49 works, as do others < 1.0.1108.44, then 1.0.1108.44 fails, as do others up to latest stable (1.0.1185.39)
Runtime: Evergreen 100.0.1185.39
Framework: Excel VSTO add-ins (1 with Winforms, 1 with WPF)
OS: Win 10 Enterprise, 21H2 19044.1586
Repro Steps
Microsoft.Web.WebView2.Core.CoreWebView2Environment.GetAvailableBrowserVersionString()
Observed: get exception (Expected: no exception)
Additional context
We have several test machines where we do not see this issue, but have identified a couple of machines where it fails as described (and succeeds using the earlier SDK).
We have looked at issues #2046 and #1236 and while we have very similar symptoms, we do not have non-english and/or special characters like # in the path (we do have hyphen, as in runtimes\win-x86).
The add-in is compiled in VS2019 for Debug/Any CPU config.
The UserDataFolder is set to a folder under %localappdata%, and there are no other WV2 instances using that folder (although we have not gotten to the WV2 init code yet).
Questions
@champnic
Is there a way to get additional diagnostics about the details of the load failure? I tried fuslogvw but that did not seem to help (caveat: it was my first time using that tool).
AB#39143740
The text was updated successfully, but these errors were encountered: