-
Notifications
You must be signed in to change notification settings - Fork 55
Description
Greetings,
I would like some help on debugging this issue - I am unsure if this is bug within the DataverseServiceClient or a dependency missmatch issue.
I am getting the below runtime error when initializing a connection via: Microsoft.PowerPlatform.Dataverse.Client.ServiceClient:
Microsoft.PowerPlatform.Dataverse.Client.Utils.DataverseConnectionException
HResult=0x80131500
Message=Failed to connect to Dataverse
Source=Microsoft.PowerPlatform.Dataverse.Client
StackTrace:
at Microsoft.PowerPlatform.Dataverse.Client.ServiceClient.CreateServiceConnection(Object externalOrgServiceProxy, AuthenticationType requestedAuthType, String hostName, String port, String orgName, NetworkCredential credential, String userId, SecureString password, String domain, String Geo, String claimsHomeRealm, Boolean useSsl, Boolean useUniqueInstance, OrganizationDetail orgDetail, String clientId, Uri redirectUri, PromptBehavior promptBehavior, OrganizationWebProxyClientAsync externalOrgWebProxyClient, String certificateThumbPrint, StoreName certificateStoreName, X509Certificate2 certificate, Uri instanceUrl, Boolean isCloned, Boolean useDefaultCreds, Version incomingOrgVersion, ILogger externalLogger, String tokenCacheStorePath)
at Microsoft.PowerPlatform.Dataverse.Client.ServiceClient.ConnectToService(String connectionString, ILogger logger)
at Microsoft.PowerPlatform.Dataverse.Client.ServiceClient..ctor(String dataverseConnectionString, ILogger logger)
at RSM.INIT.POC.FUNC2.Function1.Run(JObject foo, ILogger log) in C:\Users\e087011\source\repos\Integrations\RSM.INIT.POC\RSM.INIT.POC.FUNC2\Function1.cs:line 33
at Microsoft.Azure.WebJobs.Host.Executors.VoidMethodInvoker`2.InvokeAsync(TReflected instance, Object[] arguments) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\VoidMethodInvoker.cs:line 21
at Microsoft.Azure.WebJobs.Host.Executors.FunctionInvoker`2.<InvokeAsync>d__10.MoveNext() in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionInvoker.cs:line 52
This exception was originally thrown at this call stack:
[External Code]
Inner Exception 1:
AggregateException: One or more errors occurred. (Could not load file or assembly 'Microsoft.Identity.Client.Extensions.Msal, Version=2.18.9.0, Culture=neutral, PublicKeyToken=0a613f4dd989e8ae'. The system cannot find the file specified.)
Inner Exception 2:
FileNotFoundException: Could not load file or assembly 'Microsoft.Identity.Client.Extensions.Msal, Version=2.18.9.0, Culture=neutral, PublicKeyToken=0a613f4dd989e8ae'. The system cannot find the file specified.
Decompiling the source code during runtime, I can see that the exception is being thrown on line: 1177 in ServiceClient.cs. Evidently, some code in the try block is throwing the exception.
For reference, I am using version: 0.5.5 of the DataverseServiceClient within an Azure function version 3. The application is targeting netcoreapp3.1.
In addition, I can see that the current version of the DataverseServiceClient references version 4.35.1 of Microsoft.Identity.Client. So I'm not sure why the package is trying to load a different version
In short, I am not sure if this exception is originating form within this package, or from one of its dependencies.
Any assistance on debugging this issue would be appreciated. Please let me know if there is anymore information I can provide.
Edit:
After some further digging, I noticed that an exception is being thrown:
This exception was originally thrown at this call stack:
Microsoft.PowerPlatform.Dataverse.Client.ConnectionService.InitServiceAsync()
Backtracking the code, I can tell that the call order is:
doLogin() on line 1149 in ServiceClient.cs, then IntilizeService on line 793 in ConnectionService.cs, then this.GetCachedService on line 831 in ConnectionService.cs, then InitServiceAsync().Result on line 861.
Past that, I am not able to trace the problem back any further.