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] MSAL NuGet package needs an rd.xml to work correctly in UWP apps

See original GitHub issue

Which Version of MSAL are you using ? MSAL 4.8.1

Platform UWP

What authentication flow has the issue?

  • Desktop / Mobile
    • Interactive

Is this a new or existing app? a. The app is in production, and I have upgraded to a new version of MSAL

Repro Create a UWP app project in VS 2019. Add auth to it, as per https://docs.microsoft.com/en-us/azure/active-directory/develop/tutorial-v2-windows-uwp

Enable .NET Native compilation and run the app. Sign-in will throw an exception with the following error message: Authorize endpoint was not found in the openid configuration

Expected behavior Auth should work.

Actual behavior Exception is thrown.

Possible Solution

You should ship an rd.xml containing the following directive (or similar):

<Assembly Name="Microsoft.Identity.Client" Dynamic="Required All" />

cf https://devblogs.microsoft.com/dotnet/net-native-deep-dive-making-your-library-great/

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
mfeingolcommented, Dec 14, 2020

@bgavrilMS: here’s a repro.

Build in x64 debug and observe that you can sign in by clicking on the Log in button.

Then build x64 release and try again. Instead of a successful login, the library will throw Microsoft.Identity.Client.MsalClientException: client info is null

MsalDotNetNative.zip

Please note that you will need to set your own client id and redirect id in MainPage.xaml.cs

Thanks.

1reaction
LDS2020commented, May 25, 2020

@mfeingol, thank you for reporting this bug. I spent over a week trying to fix this and would never have thought to modify the rd.xml file. I made your suggested change and it now works.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fixing “Payload file rd.xml does not exist” when creating a ...
Here rd.xml files were pulled into the package by file - kind of like I was ... does not exist” when creating a...
Read more >
Runtime Directives (rd.xml) Configuration File Reference
A runtime directives (.rd.xml) file is an XML configuration file that specifies whether designated program elements are available for ...
Read more >
On a large Xamarin.Forms project with a lot of nuget ...
This is a complex problem and even though I have never seen it before, I can help to debug msbuild pipeline to solve...
Read more >
load failed UWP.csproj : error : Object reference not set to an ...
i had the same problem and it turned out that the error was caused by not having all the assets for UWP projects,...
Read more >
Microsoft.Identity.Client 4.55.0
This package contains the binaries of the Microsoft Authentication Library for .NET (MSAL.NET). MSAL.NET makes it easy to obtain tokens from the Microsoft ......
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