I am trying to generate authcontext with below code with the latest version of ADAL package (3.13.9) I am getting exception. However, I downgrade the ADAL version to v2.22.302111727 it works without an issue. I am using visual studio 2017. What is wrong with 3.13.9?
authContext = new AuthenticationContext(authority, true);
System.TypeInitializationException occurred HResult=0x80131534
Message=The type initializer for 'Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext' threw an exception.
Source=Microsoft.IdentityModel.Clients.ActiveDirectory StackTrace:
at Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext..ctor(String authority, Boolean validateAuthority) at DestinationProvider.AADToken.d__4.MoveNext() in D:\Repo\MyProjects\nv\nv\DestinationProvider\AADToken.cs:line 32 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at ReplLoop.ReplLoop.d__1.MoveNext() in D:\Repo\MyProjects\nv\nv\nvReplLoop\ReplLoop.cs:line 52Inner Exception 1: TypeInitializationException: The type initializer for 'Microsoft.IdentityModel.Clients.ActiveDirectory.PlatformPlugin' threw an exception.
Inner Exception 2: AdalException: Assembly required for the platform not found. Make sure assembly 'Microsoft.IdentityModel.Clients.ActiveDirectory.Platform, Version=3.13.8.999, Culture=neutral, PublicKeyToken=31bf3856ad364e35' exists
Inner Exception 3: FileNotFoundException: Could not load file or assembly 'Microsoft.IdentityModel.Clients.ActiveDirectory.Platform, Version=3.13.8.999, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
3.13.9
version of ADAL and compare the the version of assemblies then add the library one by one to check which library cause this issue. If you still have the problem, you may share a code project on GitHub to help to reproduce this issue. – Fei Xue - MSFT