Skip to content

System.NotSupportedException: Method ExecuteAsync is not supported on this proxy #220

Closed

Description

I'm using Microsoft.PowerPlatform.Dataverse.Client version 0.5.10 inside a .NET 6 Blazor Server App and randomly getting error System.NotSupportedException: Method ExecuteAsync is not supported on this proxy. The code works most of the times, but every now and then I get this exception. Not really sure how to reproduce, since it's happening randomly.

Stacktrace:

Unhandled exception. System.NotSupportedException: Method ExecuteAsync is not supported on this proxy, this can happen if the method is not marked with OperationContractAttribute or if the interface type is not marked with ServiceContractAttribute.
   at Microsoft.PowerPlatform.Dataverse.Client.ServiceClient.RetrieveMultipleAsync(QueryBase query, CancellationToken cancellationToken)
   at Microsoft.PowerPlatform.Dataverse.Client.ServiceClient.RetrieveMultipleAsync(QueryBase query)
   at ***.GetAccounts(String filter, Int32 limit)
   at ***.SearchAccounts(String filter)
   at Blazored.Typeahead.BlazoredTypeahead`2.Search(Object source, ElapsedEventArgs e)
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__127_1(Object state)
   at System.Threading.QueueUserWorkItemCallback.<>c.<.cctor>b__6_0(QueueUserWorkItemCallback quwi)
   at System.Threading.ExecutionContext.RunForThreadPoolUnsafe[TState](ExecutionContext executionContext, Action`1 callback, TState& state)
   at System.Threading.QueueUserWorkItemCallback.Execute()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
   at System.Threading.Thread.StartCallback()

Activity

  1. bjorkstromm commented on Dec 21, 2021

    @bjorkstromm
    Author

    Could the issue be because IOrganizationServiceAsync2 is not marked with ServiceContractAttribute and it's method not marked with OperationContractAttribute ?

  2. bjorkstromm commented on Dec 21, 2021

    @bjorkstromm
    Author

    Some more logs.

    dbug: Microsoft.PowerPlatform.Dataverse.Client.ServiceClient[16]
          Added WebClient Header Hooks to the Request object.
    dbug: Microsoft.PowerPlatform.Dataverse.Client.ServiceClient[16]
          Initialize Dataverse connection Started - AuthType: ExternalTokenManagement
    info: Microsoft.PowerPlatform.Dataverse.Client.ServiceClient[8]
          Cloned Connection, Retrieve version info from connected Dataverse organization not called
    info: Microsoft.PowerPlatform.Dataverse.Client.ServiceClient[8]
          External Dataverse Connection Provided, Skipping Validation
    dbug: Microsoft.PowerPlatform.Dataverse.Client.ServiceClient[16]
          New Batch Manager Created, Max #of Batches:50000, Max #of RequestsPerBatch:5000
    dbug: Microsoft.PowerPlatform.Dataverse.Client.ServiceClient[16]
          Execute Command - RetrieveMultiple : RetrieveMultiple to Dataverse via IOrganizationService : RequestID=ed3e946e-d7ca-4980-8832-bd2a46b8e833
    dbug: Microsoft.PowerPlatform.Dataverse.Client.ServiceClient[16]
          No retry attempted for Command RetrieveMultiple
    fail: Microsoft.PowerPlatform.Dataverse.Client.ServiceClient[2]
          ************ NotSupportedException - RetrieveMultiple : RetrieveMultiple to Dataverse via IOrganizationService |=> Method ExecuteAsync is not supported on this proxy, this can happen if the method is not marked with OperationContractAttribute or if the interface type is not marked with ServiceContractAttribute.
          Source: System.Private.ServiceModel
          Method: GetMethodData
          DateUTC: 21/12/2021
          TimeUTC: 9.34.10
          Error: Method ExecuteAsync is not supported on this proxy, this can happen if the method is not marked with OperationContractAttribute or if the interface type is not marked with ServiceContractAttribute.
          HelpLink Url: Not Provided
          Stack Trace: at System.ServiceModel.Channels.ServiceChannelProxy.GetMethodData(MethodCall methodCall)
             at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(MethodInfo targetMethod, Object[] args)
             at generatedProxy_1.ExecuteAsync(OrganizationRequest )
             at Microsoft.Xrm.Sdk.WebServiceClient.OrganizationWebProxyClientAsync.<>c__DisplayClass53_0.<ExecuteAsyncCore>b__0()
             at Microsoft.Xrm.Sdk.WebServiceClient.WebProxyClient`1.ExecuteAction[TResult](Func`1 action)
             at Microsoft.Xrm.Sdk.WebServiceClient.OrganizationWebProxyClientAsync.ExecuteAsyncCore(OrganizationRequest request)
             at Microsoft.Xrm.Sdk.WebServiceClient.OrganizationWebProxyClientAsync.ExecuteAsync(OrganizationRequest request)
             at Microsoft.PowerPlatform.Dataverse.Client.ServiceClient.Command_ExecuteAsyncImpl(OrganizationRequest req, String errorStringCheck, CancellationToken cancellationToken, Boolean bypassPluginExecution)
          ======================================================================================================================
    
          System.NotSupportedException: Method ExecuteAsync is not supported on this proxy, this can happen if the method is not marked with OperationContractAttribute or if the interface type is not marked with ServiceContractAttribute.
             at System.ServiceModel.Channels.ServiceChannelProxy.GetMethodData(MethodCall methodCall)
             at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(MethodInfo targetMethod, Object[] args)
             at generatedProxy_1.ExecuteAsync(OrganizationRequest )
             at Microsoft.Xrm.Sdk.WebServiceClient.OrganizationWebProxyClientAsync.<>c__DisplayClass53_0.<ExecuteAsyncCore>b__0()
             at Microsoft.Xrm.Sdk.WebServiceClient.WebProxyClient`1.ExecuteAction[TResult](Func`1 action)
             at Microsoft.Xrm.Sdk.WebServiceClient.OrganizationWebProxyClientAsync.ExecuteAsyncCore(OrganizationRequest request)
             at Microsoft.Xrm.Sdk.WebServiceClient.OrganizationWebProxyClientAsync.ExecuteAsync(OrganizationRequest request)
             at Microsoft.PowerPlatform.Dataverse.Client.ServiceClient.Command_ExecuteAsyncImpl(OrganizationRequest req, String errorStringCheck, CancellationToken cancellationToken, Boolean bypassPluginExecution)
    fail: Microsoft.PowerPlatform.Dataverse.Client.ServiceClient[2]
          [TerminalFailure] Failed to Execute Command - RetrieveMultiple : RequestID=ed3e946e-d7ca-4980-8832-bd2a46b8e833 : RetrieveMultiple to Dataverse via IOrganizationService duration=00:00:00.0390319 ExceptionMessage = Method ExecuteAsync is not supported on this proxy, this can happen if the method is not marked with OperationContractAttribute or if the interface type is not marked with ServiceContractAttribute.
    
          System.NotSupportedException: Method ExecuteAsync is not supported on this proxy, this can happen if the method is not marked with OperationContractAttribute or if the interface type is not marked with ServiceContractAttribute.
             at System.ServiceModel.Channels.ServiceChannelProxy.GetMethodData(MethodCall methodCall)
             at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(MethodInfo targetMethod, Object[] args)
             at generatedProxy_1.ExecuteAsync(OrganizationRequest )
             at Microsoft.Xrm.Sdk.WebServiceClient.OrganizationWebProxyClientAsync.<>c__DisplayClass53_0.<ExecuteAsyncCore>b__0()
             at Microsoft.Xrm.Sdk.WebServiceClient.WebProxyClient`1.ExecuteAction[TResult](Func`1 action)
             at Microsoft.Xrm.Sdk.WebServiceClient.OrganizationWebProxyClientAsync.ExecuteAsyncCore(OrganizationRequest request)
             at Microsoft.Xrm.Sdk.WebServiceClient.OrganizationWebProxyClientAsync.ExecuteAsync(OrganizationRequest request)
             at Microsoft.PowerPlatform.Dataverse.Client.ServiceClient.Command_ExecuteAsyncImpl(OrganizationRequest req, String errorStringCheck, CancellationToken cancellationToken, Boolean bypassPluginExecution)
    Unhandled exception. System.NotSupportedException: Method ExecuteAsync is not supported on this proxy, this can happen if the method is not marked with OperationContractAttribute or if the interface type is not marked with ServiceContractAttribute.
       at Microsoft.PowerPlatform.Dataverse.Client.ServiceClient.RetrieveMultipleAsync(QueryBase query, CancellationToken cancellationToken)
       at Microsoft.PowerPlatform.Dataverse.Client.ServiceClient.RetrieveMultipleAsync(QueryBase query)
       at ***.GetAccounts(String filter, Int32 limit)
       at ***.SearchAccounts(String filter)
       at Blazored.Typeahead.BlazoredTypeahead`2.Search(Object source, ElapsedEventArgs e)
       at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__127_1(Object state)
       at System.Threading.QueueUserWorkItemCallback.<>c.<.cctor>b__6_0(QueueUserWorkItemCallback quwi)
       at System.Threading.ExecutionContext.RunForThreadPoolUnsafe[TState](ExecutionContext executionContext, Action`1 callback, TState& state)
       at System.Threading.QueueUserWorkItemCallback.Execute()
       at System.Threading.ThreadPoolWorkQueue.Dispatch()
       at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
    
  3. HakanL commented on Jan 26, 2022

    @HakanL

    I got this error as well (on a different WCF client), it started when I upgraded to .NET 6 (but I'm not 100% sure that's the cause, since I also started to use the WCF client differently). But my issue was that I wasn't calling Close (or CloseAsync) on the client after each use, so I think I ran out of resources and got the NotSupportedException.

  4. added
    Investigating
    on Jan 27, 2022
  5. MattB-msft commented on Jan 27, 2022

    @MattB-msft
    Member

    Martin Björkström (@bjorkstromm) what are the conditions you're running the blazer server with?
    IE:
    are you seeing this under load?
    are you creating a thread pool to work with ?
    did you use a ServiceClient as a static? or are you creating based on request?, if so how? (connection string or constructor)

    thanks.

  6. bjorkstromm commented on Jan 27, 2022

    @bjorkstromm
    Author

    Martin Björkström (@bjorkstromm) what are the conditions you're running the blazer server with?
    IE:
    are you seeing this under load?
    are you creating a thread pool to work with ?
    did you use a ServiceClient as a static? or are you creating based on request?, if so how? (connection string or constructor)

    thanks.

    I've noticed that I'm only seeing this when running code with hot-reload (dotnet watch run). I see this exception usually after I've saved some changes to the code, and hot-reload have been performed.

    I have a singleton ServiceClient, created lazily which I clone for each request. After each request is finished, I dispose the cloned client.

  7. MattB-msft commented on Feb 17, 2022

    @MattB-msft
    Member

    Martin Björkström (@bjorkstromm)
    We are having a heck of a time reproducing this. So far we have not seen it.
    would you be willing to share a sample project where this is happening?

  8. kbiasci commented on Mar 9, 2022

    @kbiasci

    I have the same problem, the WCF service is also a singleton but I close it everytime after use.

    The name of the function called is not exactly the same as the name of the operation contract.
    Could it have become an issue?

    Contract:

    [System.ServiceModel.OperationContractAttribute(Action = "http://company.co.nz/IConsumers/GetCreditReportProducts", ReplyAction = "http://company.co.nz/IConsumers/GetCreditReportProductsResponse")]
    System.Threading.Tasks.Task<Company.Rosie.CompanyWebService.CreditReportProductsResult> GetCreditReportProductsAsync(Company.Rosie.CompanyWebService.CreditReportProductsRequest CreditReportProductsRequest);
    

    Exception message:
    "Request has failed, reason: Method GetCreditReportProductsAsync is not supported on this proxy, this can happen if the method is not marked with OperationContractAttribute or if the interface type is not marked with ServiceContractAttribute."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Investigating

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions