Skip to content

Unable to cast object of type 'generatedProxy_2' #48

@smfpride

Description

@smfpride

I'm getting an odd error occasionally that just started happening in the last couple of weeks. I'm using version 0.2.16-Alpha in an Azure Function (v3.0.9 SDK, runtime version 3.0.14287.0). I have a watchDirectory (Azure Function host.json setting) set, and have a function that updates a file in that directory to restart the Azure Function, the restart works, but after the Azure Function finishes restarting I receive the follow errors whenever attempting to connect to my CDS environment:

"InnerException": {
"ClassName": "System.InvalidCastException",
"Message": "Unable to cast object of type 'generatedProxy_2' to type 'Microsoft.Xrm.Sdk.IOrganizationService'.",
"Data": null,
"InnerException": null,
"HelpURL": null,
"StackTraceString": " at Microsoft.PowerPlatform.Cds.Client.CdsConnectionService.InitCdsService()",
"RemoteStackTraceString": null,
"RemoteStackIndex": 0,
"ExceptionMethod": null,
"HResult": -2147467262,
"Source": "System.Reflection.DispatchProxy",
"WatsonBuckets": null
},

"StackTraceString": " at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)\r\n at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification)\r\n at System.Threading.Tasks.Task1.get_Result()\r\n at Microsoft.PowerPlatform.Cds.Client.CdsConnectionService.GetCachedCDSService(CdsConnectionService& ConnectionObject)\r\n at Microsoft.PowerPlatform.Cds.Client.CdsConnectionService.IntilizeService(CdsConnectionService& ConnectionObject)\r\n at Microsoft.PowerPlatform.Cds.Client.CdsServiceClient.CreateCdsServiceConnection(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, UserIdentifier user, String clientId, Uri redirectUri, PromptBehavior promptBehavior, String tokenCachePath, OrganizationWebProxyClient externalOrgWebProxyClient, String certificateThumbPrint, StoreName certificateStoreName, X509Certificate2 certificate, Uri instanceUrl, Boolean isCloned, Boolean useDefaultCreds)",
"RemoteStackTraceString": null,
"RemoteStackIndex": 0,
"ExceptionMethod": null,
"HResult": -2146233088,
"Source": "System.Private.CoreLib",

"StackTraceString": " at Microsoft.PowerPlatform.Cds.Client.CdsServiceClient.CreateCdsServiceConnection(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, UserIdentifier user, String clientId, Uri redirectUri, PromptBehavior promptBehavior, String tokenCachePath, OrganizationWebProxyClient externalOrgWebProxyClient, String certificateThumbPrint, StoreName certificateStoreName, X509Certificate2 certificate, Uri instanceUrl, Boolean isCloned, Boolean useDefaultCreds)\r\n at Microsoft.PowerPlatform.Cds.Client.CdsServiceClient.ConnectToCdsService(String cdsConnectionString)\r\n at Microsoft.PowerPlatform.Cds.Client.CdsServiceClient..ctor(String cdsConnectionString)\r\n at ....",
"RemoteStackTraceString": null,
"RemoteStackIndex": 0,
"ExceptionMethod": null,
"HResult": -2146233088,
"Source": "Microsoft.PowerPlatform.Cds.Client",

If I stop the Azure Function, wait a few moments, start the Azure Function, the connection works fine.

Any thoughts on this? Another thing to note is that no code changes have occurred with these Azure Functions in about a month (prior to about 2 weeks ago, they were working wonderfully).

EDITED: Updated to latest versions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions