-
Notifications
You must be signed in to change notification settings - Fork 115
Description
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)