question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] [S] WebView2Loader.dll is missing in net472 app

See original GitHub issue

Which Version of MSAL are you using ? 4.33

Platform net472

What authentication flow has the issue? Interactive WebView2

Repro 1 WebView2LoaderRepro.zip

  • WebView2Library references WebView2 SDK NuGet.
  • WebView2Library does specify AnyCPU PlatformTarget explicitly.
  • WebView2Library is packed as a NuGet.
  • WebView2App references WebView2Library as a NuGet.
  • Run WebView2App for net472 target.

Repro 2

  1. Use NetDesktopWinFormsWAM project.
  2. Update to reference MSAL NuGet instead of source code project.
  3. Build, run, do interactive request.
  4. WebView2Loader error occurs.

Expected behavior WebView2 should show up.

Actual behavior If App targets net472, I see different behavior depending on the PlatformTarget element in the App csproj.

  • None specified - BadImageFormatException
  • AnyCPU - DllNotFoundException
  • x86 or x64 - everything works

Additional context / logs / screenshots Current workaround is to set PlatformTarget to either x86 or x64 in the app’s project file.

Related issue in WebView2 repo: Using WebView2 in a WPF Assembly

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
pmaytakcommented, Apr 9, 2021

@bgavrilMS Adding PlatformTarget element workaround doesn’t work for us.

Should we exclude WebView2 here for NetFx targets? https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/blob/c25582a72f1dd7f9a3270120c490734d164c4dc0/src/client/Microsoft.Identity.Client/Platforms/Features/WebView2WebUi/WebView2WebUiFactory.cs#L46-L50

NetDesktopWinFormsWAM still doesn’t include the WebView2Loader.dll. image

NetCoreWinFormsWAM does include the different WebView2Loader.dll runtimes. image

Also for reference: Release notes for WebView2 SDK.

1reaction
bgavrilMScommented, Mar 18, 2021

I was not able to reproduce this issue. @pmaytak - could you try to create a simple repro and open a bug on WebView2 team ? Should be sufficient to just try

string s = CoreWebView2Environment.GetAvailableBrowserVersionString();
Console.WriteLine(s);
Read more comments on GitHub >

github_iconTop Results From Across the Web

WebView2Loader.dll is missing in net472 app #1091
Exception is thrown when WebView2Loader.dll cannot be loaded. When the library project is referenced as a project, included in solution, ...
Read more >
Unable to load DLL 'WebView2Loader.dll' The specified ...
Here in February 2023 I encounter this same DllNotFound error while recently debugging a WPF project that was calling a WebView2 method.
Read more >
webview2loader.dll free download
Download webview2loader.dll free! Fix DLL missing error. Solve it yourself or get help using DLL‑files.com Client to fix DLL error automatically.
Read more >
Pop-up msg at start saying ....\WebView2 Loader.dll ...
\WebView2 Loader.dll contains an error. Hi. Each time I start windows11 I get a pop-up message C:\Program\Files\WindowsApps\Microsoftteams_22 ...
Read more >
Unable to load DLL 'libHarfBuzzSharp' error when using ...
I have some GemBox PDF code in a class library, which works fine when the class library targets .NET framework 4.7.2 (and consequently...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found