I am developing UWP app in Xamarin and using Active Directory authentication to activate register in Dynamic 365.
My authentication code runs fine for Active Directory Login but after that for getting user ID token from activated Register of Dynamic 365 I am using below code
IAuthenticationManager authenticationManager = App.currentManagerFactory.GetManager<IAuthenticationManager>();
CommerceAuthenticationParameters commerceParameters = new CommerceAuthenticationParameters("password", "Modern POS");
this.UserIdToken = await authenticationManager.AcquireToken("000123", "123", commerceParameters);
The above code is throwing below exception. This code is working fine for Android App but only for UWP app it is not working.
Could not load file or assembly 'System.ComponentModel.DataAnnotations, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Below is the stack trace for above given exception -
at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName, ObjectHandleOnStack type, ObjectHandleOnStack keepalive) at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName) at System.RuntimeType.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark) at System.Type.GetType(String typeName) at Newtonsoft.Json.Serialization.JsonTypeReflector.GetMetadataTypeAttributeType() at Newtonsoft.Json.Serialization.JsonTypeReflector.GetAssociateMetadataTypeFromAttribute(Type type) at Newtonsoft.Json.Utilities.ThreadSafeStore
2.AddValue(TKey key) at Newtonsoft.Json.Utilities.ThreadSafeStore2.Get(TKey key) at Newtonsoft.Json.Serialization.JsonTypeReflector.GetAssociatedMetadataType(Type type) at Newtonsoft.Json.Serialization.JsonTypeReflector.GetAttribute[T](Type type) at Newtonsoft.Json.Serialization.JsonTypeReflector.GetAttribute[T](Object provider) at Newtonsoft.Json.Utilities.ThreadSafeStore2.AddValue(TKey key) at Newtonsoft.Json.Utilities.ThreadSafeStore2.Get(TKey key) at Newtonsoft.Json.Serialization.CachedAttributeGetter1.GetAttribute(Object type) at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateContract(Type objectType) at Newtonsoft.Json.Serialization.DefaultContractResolver.ResolveContract(Type type) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent) at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType) at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings) at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings) at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value) at Contoso.Commerce.RetailProxy.Authentication.CommerceAuthenticationRetailServerProvider.<AcquireToken>d__8.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult() at Contoso.Commerce.RetailProxy.Authentication.CommerceAuthenticationProvider.<ExecuteAuthenticationSingleResultOperationAsync>d__181.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at Contoso.Commerce.RetailProxy.RetailServerContext.<ExecuteAuthenticationOperationSingleResultAsync>d__421.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at Contoso.Commerce.RetailProxy.CommerceAuthenticationManager.<AcquireToken>d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at RetailServerMobilityWinApp.Login.d__5.MoveNext()
Thanks.