We are trying to call a dll containing a C# class library from AX. The dll is used to delete users from B2C AAD using the GraphAPI. When trying this from a console application the process is executed successfully. We are adding a reference of the dll to an AX project and we get the below error on execution:
C# dll:
var test = Task.Run(() => authenticationContext.AcquireTokenAsync(par1, par2, new UserPasswordCredential(GraphUserName, GraphPassword))).ConfigureAwait(false).GetAwaiter().GetResult();
AX call to the dll:
AzureHelpers.Cleanup::CleanupUsers(objectIdsList,azureSettingsDictionary);
Error:
Could not load type 'Microsoft.IdentityModel.Clients.ActiveDirectory.UserPasswordCredential' from assembly 'Microsoft.IdentityModel.Clients.ActiveDirectory.Platform, Version=3.13.8.999, Culture=neutral, PublicKeyToken=31bf3856ad364e35' because the parent type is sealed.