Skip to content

gladjohn/WPF-NativeDll-LoadIssue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sample WPF App

This app is a minimum WPF app to reproduce the error 'Unable to load DLL 'msalruntime' when trying to follow this doc to use the new version (4.49.1-preview) of Microsoft.Identity.Client.Broker.

Steps to reproduce

  1. Clone this repo.
  2. Build the solution to restore all nuget packages.
  3. Start the project "WPF" project.
  4. You will be displayed with a window with a button and a text box
  5. Click on the Acquire Token Interactively button

Result : You should now see the Windows Web Account Manager UI showing up and prompting you to sign in to the app. You can use the MS Credentials or use the following user details to sign-in. But sign in is actually not required. The WAM (Web Account Manager) UI is from the Native dll (msalruntime.dll) packaged along with Microsoft.Identity.Client.Broker

Identity Lab Account User Name : [email protected]

Identity Lab Account Password : https://msidlab.com/api/LabSecret?&Secret=msidlab4 (Please do not share this secret or add it to your response)

  1. Now set the WPF.Package as the start up project
  2. Start the project "WPF.Package" project.
Microsoft.Identity.Client.MsalClientException: 'Unable to load DLL 'msalruntime': The specified module could not be found. (Exception from HRESULT: 0x8007007E) See https://aka.ms/msal-net-wam#troubleshooting'

Inner Exception
DllNotFoundException: Unable to load DLL 'msalruntime_x86': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

image

Alternative Repro :

You can also deploy the package and launch it, this will crash the app. And App logs will show the same error

image

Investigation so far:

WPF project gets the runtimes folder and it's contents (msalruntime native dlls)

image

image

AppX also contains the runtimes folder and it's contents

image

Fix we have done :

  • Manually copy the dlls from the runtimes folder and place them in the executing assembly directory
  • deploy the package
  • Launch the app. It will work as expected

image

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages