I am using the Web API in the plugins on CRM Online 2016.
I know that when registering the plugin assembly on server, it's a bad practice to merge the CRM assemblies provided by microsoft.
However, not including 'Microsoft.IdentityModel.Clients.ActiveDirectory' in assembly gave me this error :
Could not load file or assembly 'Microsoft.IdentityModel.Clients.ActiveDirectory, Version=2.28.1.741, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
So, i included this in the assembly and the assembly got registered on CRM online.
But during runtime, i got this error :
An exception occurred during the initialization of the Plug-in Profiler. Unhandled Exception: System.TypeLoadException: Inheritance security rules violated while overriding member: 'Microsoft.IdentityModel.Clients.ActiveDirectory.AdalException.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.
It looks this has something to do with the sandbox mode restrictions.
Any pointers on how to fix it?
*This post is locked for comments