Skip to content

NullReferenceException when cloning service client #148

Closed
@svejdo1

Description

@svejdo1

Scenario:

  1. attempt to get CDS client, when the connection to CDS times out on creation

var foo = new ServiceClient(instanceUrl, tokenProvider);

This sometimes times out when CDS is busy - e.g. following is returned (which is fine).

Microsoft.PowerPlatform.Dataverse.Client.Utils.DataverseConnectionException: Failed to connect to Dataverse ---> System.AggregateException: One or more errors occurred. (The request channel timed out attempting to send after 00:01:00. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding. The time allotted to this operation may have been a portion of a longer timeout.) ---> System.TimeoutException: The request channel timed out attempting to send after 00:01:00. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding. The time allotted to this operation may have been a portion of a longer timeout. ---> System.TimeoutException: The HTTP request to 'https://sg867tp1crmhubfshorg-00135-psme.api.crm10.dynamics.com/XRMServices/2011/Organization.svc/web?SDKClientVersion=9.0.46.3291' has exceeded the allotted timeout of 00:01:00. The time allotted to this operation may have been a portion of a longer timeout. at System.ServiceModel.Channels.HttpChannelFactory1.HttpClientRequestChannel.HttpClientChannelAsyncRequest.SendRequestAsync(Message message, TimeoutHelper timeoutHelper)
at System.ServiceModel.Channels.RequestChannel.RequestAsync(Message message, TimeSpan timeout)
--- End of inner exception stack trace ---
at Microsoft.PowerPlatform.Dataverse.Client.ConnectionService.InitServiceAsync()
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification) at Microsoft.PowerPlatform.Dataverse.Client.ConnectionService.GetCachedService(ConnectionService& ConnectionObject) at Microsoft.PowerPlatform.Dataverse.Client.ConnectionService.IntilizeService(ConnectionService& ConnectionObject) 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, OrganizationWebProxyClient externalOrgWebProxyClient, String certificateThumbPrint, StoreName certificateStoreName, X509Certificate2 certificate, Uri instanceUrl, Boolean isCloned, Boolean useDefaultCreds, Version incomingOrgVersion, ILogger externalLogger) --- End of inner exception stack trace --- 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, OrganizationWebProxyClient externalOrgWebProxyClient, String certificateThumbPrint, StoreName certificateStoreName, X509Certificate2 certificate, Uri instanceUrl, Boolean isCloned, Boolean useDefaultCreds, Version incomingOrgVersion, ILogger externalLogger) at Microsoft.PowerPlatform.Dataverse.Client.ServiceClient..ctor(Uri instanceUrl, Func2 tokenProviderFunction, Boolean useUniqueInstance, ILogger logger)`

  1. However when we kick the retry (T+1minute within the same process) we get the client successfully; however the cloning fails on

var foo = new ServiceClient(instanceUrl, tokenProvider); var bar = foo.Clone();

System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.PowerPlatform.Dataverse.Client.ConnectionService.SetClonedProperties(ServiceClient sourceClient) at Microsoft.PowerPlatform.Dataverse.Client.ServiceClient.Clone(Assembly strongTypeAsm, ILogger logger)

Which is not ok

Metadata

Metadata

Assignees

No one assigned

    Labels

    InvestigatingWe are looking into this issue at this time.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions