-
Notifications
You must be signed in to change notification settings - Fork 347
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
[Bug] MSAL Broker unable to load 'msalruntime.dll' when packaged as MSIX #3740
Comments
It seems like this happens because the runtime folder is only on the publish folder. I believe there is a way to provide a PublishProfile to wapproj, but I'm not sure. |
I came up with a workaround. In your wapproj file, add this: <ItemGroup>
<PackageReference Include="Microsoft.Identity.Client.NativeInterop" Version="0.13.0" GeneratePathProperty="true"/>
</ItemGroup>
<ItemGroup>
<ContentWithTargetPath Include="$(PkgMicrosoft_Identity_Client_NativeInterop)\runtimes\win-x86\native\*" TargetPath="runtimes\win-x86\native\%(Filename)%(Extension)" CopyToOutputDirectory="PreserveNewest" />
<ContentWithTargetPath Include="$(PkgMicrosoft_Identity_Client_NativeInterop)\runtimes\win-x64\native\*" TargetPath="runtimes\win-x64\native\%(Filename)%(Extension)" CopyToOutputDirectory="PreserveNewest" />
<ContentWithTargetPath Include="$(PkgMicrosoft_Identity_Client_NativeInterop)\runtimes\win-arm64\native\*" TargetPath="runtimes\win-arm64\native\%(Filename)%(Extension)" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup> |
It looks like although VisualStudio generates the following warning message, the dlls are still successfully copied to the target path.
In a SampleApp I created for reproducing this error, the only issue is the same error still happens when directly hit "run" in VisualStudio. I'm guessing maybe these dlls are not yet ready in the target path when VisualStudio starts the debug session. It won't complain |
ping @gladjohn on repro steps. |
So far in my investigation the issue seems to be related to MSIX packaging and it's limitation on not being able to check the environment variables. Our runtime dll load logic sets the environment variable exploring how this can be achieved with MSIX |
@gladjohn - we can drop the env variable stuff and rely on Originally the logic was relying on |
I should get an update from .NET team by eod today (1/23), if there are other ways to get around this or if there is a viable workaround. I will post my findings here and discuss to the approach we want to take. Will add |
Hi Guys, This issue is also reproducible when a C# WinForm application (.NET 4.8 Framework) is published thru ClickOnce (Visual Studio 2022 - v17.7.4) Should I have to open other issue to track it once this already closed? The msalruntime.dll library is not included in the ClickOnce publish folder. Thanks in advance, |
Hi @luronumen - let's please open a new issue and mention this one. There is too much history here that might not be relevant. |
Hi @bgavrilMS I have open the #4369 issue to track it. Please let me know if you need any other info. Thanks in advanced, |
I am working in blazor maui app, whre we are pulling meeting info form exchange. this is working fine in windows and android, but in iOS (IPAD) it shows the error System.DllNotFoundException: 'msalruntime_arm64' |
@ravikumarpatra - the broker package is only expected to work on Windows and later on Mac and Linux. We don't have support for MacCatalyst (there is a feature request already). I suggest that for mac-catalyst target framework you don't reference Microsoft.Identity.Client.Broker |
Logs and network traces
Which version of MSAL.NET are you using?
Microsoft.Identity.Client 4.47.2
Microsoft.Identity.Client.Broker 4.47.2-preview
Microsoft.Identity.Client.NativeInterop 0.13.0
Platform
C# WPF (.NET Framework 4.8) packaged as MSIX through Windows Application Packaging Project
What authentication flow has the issue?
WAM
Is this a new or existing app?
Discovered the issue when migrating from
Microsoft.Identity.Client.Desktop
toMicrosoft.Identity.Client.Broker
as per this documentationRepro
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.BrokerError :
Extended error info and workarounds can be found in the repo link
Expected behavior
Using WAM as a broker should not fail
Actual behavior
MSAL throws
Microsoft.Identity.Client.MsalClientException: Unable to load DLL 'msalruntime': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
The text was updated successfully, but these errors were encountered: