microsoft / ApplicationInsights-ServiceFabric

ApplicationInsights SDK for ServiceFabric projects
MIT License
63 stars 26 forks source link

After upgrading Service Fabric SDK to 3.2 CorrelatingServiceProxyFactory throws MissingMethodException #83

Closed berndku closed 6 years ago

berndku commented 6 years ago

We have Service Fabric services using SF SDK 3.0 and Service Remoting v1. They were instrumented with CorrelatingServiceProxyFactory and CorrelatingRemotingMessageHandler and everything worked.

The ServiceProxy was created like this: return new CorrelatingServiceProxyFactory( _serviceContext, (c) => new clientV1.FabricTransportServiceRemotingClientFactory(transportSettings, c));

After upgrading the service to SF SDK 3.2 we see the following runtime exception:

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

ExceptionType: System.MissingMethodException

Stack Trace: at Microsoft.ApplicationInsights.ServiceFabric.Remoting.Activities.CorrelatingServiceProxyFactory..ctor(ServiceContext serviceContext, Func`2 createServiceRemotingClientFactory, OperationRetrySettings retrySettings)\r\n at …

Is the library supported with SF SDK 3.2 ?

yantang-msft commented 6 years ago

@berndku I haven't tested Remoting V1 on SF SDK 3.2. But I checked the Remoting 3.2.176 dll, and this method Void Microsoft.ServiceFabric.Services.Remoting.Client.ServiceProxyFactory..ctor(System.Func`2<Microsoft.ServiceFabric.Services.Remoting.V1.IServiceRemotingCallbackClient,Microsoft.ServiceFabric.Services.Remoting.V1.Client.IServiceRemotingClientFactory>, Microsoft.ServiceFabric.Services.Communication.Client.OperationRetrySettings) is indeed there.

Is it possible for you to upgrade Remoting V1 to V2? And you don't need to use the custom CorrelatingServiceProxyFactory going forward. If this is not an option for you, I can try sometime later and see if I can reproduce your issue.

berndku commented 6 years ago

Unfortunately we cannot upgrade all our services to Remoting V2 at the moment and this issue is blocking our upgrade to Service Fabric 3.2. Therefore it would be great, if you could test with 3.2. and let us know, if you can repro the issue.

yantang-msft commented 6 years ago

What's the exact SDK version that you upgraded to?

berndku commented 6 years ago

3.2.176

yantang-msft commented 6 years ago

@berndku I can reproduce the issue. And it's because SF changed the one function signature from public ServiceProxyFactory(Func<IServiceRemotingCallbackClient, Microsoft.ServiceFabric.Services.Remoting.V1.Client.IServiceRemotingClientFactory> createServiceRemotingClientFactory, OperationRetrySettings retrySettings = null) to public ServiceProxyFactory(Func<IServiceRemotingCallbackClient, Microsoft.ServiceFabric.Services.Remoting.V1.Client.IServiceRemotingClientFactory> createServiceRemotingClientFactory, OperationRetrySettings retrySettings = null, Action<Microsoft.ServiceFabric.Services.Remoting.V1.Client.IServiceRemotingClientFactory> disposeFactory = null)

To fix this issue, we can release a new package that references the latest SF package with this signature change. I'll also talk to the SF team and see how we can prevent this from happening in the future.

berndku commented 6 years ago

@yantang-msft Many thanks for the analysis. Looking forward to a new package.

yantang-msft commented 6 years ago

@berndku Version 2.2.0 is released to address this issue. Please give it a shot.

berndku commented 6 years ago

The issue is fixed with 2.2.0. Many thanks for the very fast response!!

MichVanMooter commented 6 years ago

We had the exact same issue and was fixed by upgrading to version 2.2.0. Thanks all :-)