Skip to content

After upgrading Service Fabric SDK to 3.3.644 ServiceProxyFactory throws MissingMethodException #192

@juergstaub

Description

@juergstaub

After we upgraded from ServiceFabric from V3.1.283 to V3.3.644 we receive the following exception:

Method not found: 'Void Microsoft.ServiceFabric.Services.Remoting.Client.ServiceProxyFactory..ctor(System.Func`2<Microsoft.ServiceFabric.Services.Remoting.V2.Client.IServiceRemotingCallbackMessageHandler,Microsoft.ServiceFabric.Services.Remoting.V2.Client.IServiceRemotingClientFactory>, Microsoft.ServiceFabric.Services.Communication.Client.OperationRetrySettings)'.

The service is using remoting V2, the proxy is implemented as follows:

using System;
using Microsoft.ServiceFabric.Services.Communication.Client;
using Microsoft.ServiceFabric.Services.Remoting.Client;
using Microsoft.ServiceFabric.Services.Remoting.FabricTransport;
using Microsoft.ServiceFabric.Services.Remoting.V2.FabricTransport.Client;

namespace ServiceThree.Interface.Proxy
{
    public class ServiceThreeProxyV2
    {
        private readonly IServiceProxyFactory factory;
        private static readonly Lazy<IServiceProxyFactory> factoryGenerator = new Lazy<IServiceProxyFactory>(() =>
        {
            var transportSettings = new FabricTransportRemotingSettings
            {
                OperationTimeout = TimeSpan.FromSeconds(30)
            };
            var retrySettings = new OperationRetrySettings();
            var clientFactory = new FabricTransportServiceRemotingClientFactory(transportSettings);
            return new ServiceProxyFactory(c => clientFactory,retrySettings);
        });

        public ServiceThreeProxyV2()
            : this(factoryGenerator.Value)
        {
        }

        public ServiceThreeProxyV2(IServiceProxyFactory factory)
        {
            this.factory = factory;
        }

        public IServiceThree Create(string applicationName)
        {
            var serviceUri = new Uri($"fabric:/{applicationName}/ServiceThree");
            return factory.CreateServiceProxy<IServiceThree>(serviceUri);
        }
    }
}

The issue is similar to this one: upgrading Service Fabric SDK to 3.2

The constructor of ServiceProxyFactory in V3.3.644 vs V3.1.283 has an additional optional 3rd argument:

public ServiceProxyFactory(
    Func<IServiceRemotingCallbackMessageHandler, 
    Remoting.V2.Client.IServiceRemotingClientFactory> createServiceRemotingClientFactory,
    OperationRetrySettings retrySettings = null,
    Action<Remoting.V2.Client.IServiceRemotingClientFactory> disposeFactory = null)

This constructor cannot be found, the solution would be to have two different constructors:

public ServiceProxyFactory(
    Func<IServiceRemotingCallbackMessageHandler, 
    Remoting.V2.Client.IServiceRemotingClientFactory> createServiceRemotingClientFactory,
    OperationRetrySettings retrySettings = null)
public ServiceProxyFactory(
    Func<IServiceRemotingCallbackMessageHandler, 
    Remoting.V2.Client.IServiceRemotingClientFactory> createServiceRemotingClientFactory,
    OperationRetrySettings retrySettings,
    Action<Remoting.V2.Client.IServiceRemotingClientFactory> disposeFactory)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions