【问题标题】:Service Fabric with F# not working使用 F# 的 Service Fabric 无法正常工作
【发布时间】:2017-03-27 01:58:40
【问题描述】:

我尝试将带有“Actor Service”的“Service Fabric Applicatoin”的默认模板从 C# 转换为 F#。

这里是githubrepo。

我可以编译所有内容,但是当我将其部署到本地集群时,我得到了System.ArgumentNullException。有谁知道这里有什么问题吗?

这是堆栈跟踪(它是德语,抱歉):

bei System.Reflection.Emit.FieldBuilder..ctor(TypeBuilder typeBuilder, String fieldName, Type type, Type[] requiredCustomModifiers, Type[] optionalCustomModifiers, FieldAttributes attributes)
bei System.Reflection.Emit.TypeBuilder.DefineFieldNoLock(String fieldName, Type type, Type[] requiredCustomModifiers, Type[] optionalCustomModifiers, FieldAttributes attributes)
bei System.Reflection.Emit.TypeBuilder.DefineField(String fieldName, Type type, Type[] requiredCustomModifiers, Type[] optionalCustomModifiers, FieldAttributes attributes)
bei Microsoft.ServiceFabric.Services.Remoting.Builder.MethodBodyTypesBuilder.BuildRequestBodyType(ICodeBuilderNames codeBuilderNames, CodeBuilderContext context, MethodDescription methodDescription)
bei Microsoft.ServiceFabric.Services.Remoting.Builder.MethodBodyTypesBuilder.Build(ICodeBuilderNames codeBuilderNames, CodeBuilderContext context, MethodDescription methodDescription)
bei Microsoft.ServiceFabric.Services.Remoting.Builder.MethodBodyTypesBuilder.Build(InterfaceDescription interfaceDescription)
bei Microsoft.ServiceFabric.Services.Remoting.Builder.CodeBuilder.Microsoft.ServiceFabric.Services.Remoting.Builder.ICodeBuilder.GetOrBuildMethodBodyTypes(Type interfaceType)
bei Microsoft.ServiceFabric.Services.Remoting.Builder.MethodDispatcherBuilder`1.Build(InterfaceDescription interfaceDescription)
bei Microsoft.ServiceFabric.Services.Remoting.Builder.CodeBuilder.Microsoft.ServiceFabric.Services.Remoting.Builder.ICodeBuilder.GetOrBuilderMethodDispatcher(Type interfaceType)
bei Microsoft.ServiceFabric.Actors.Remoting.Builder.ActorCodeBuilder.GetOrCreateMethodDispatcher(Type actorInterfaceType)
bei Microsoft.ServiceFabric.Actors.Remoting.Runtime.ActorMethodDispatcherMap..ctor(ActorTypeInformation actorTypeInformation)
bei Microsoft.ServiceFabric.Actors.Runtime.ActorRuntime.<RegisterActorAsync>d__7`1.MoveNext()
---  Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
bei System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
bei System.Runtime.CompilerServices.TaskAwaiter.GetResult()
bei Program.main(String[] argv) in C:\Users\tomas\Projects\playground\MyServiceFabricApp\MyActor\Program.fs:Zeile 18.

【问题讨论】:

    标签: c# f# azure-service-fabric


    【解决方案1】:

    你的问题很微妙。我自己偶然发现了这个。

    actor 接口中的每个参数都必须有一个显式 名称。感谢 Isaac Abraham 在他的blog post 中提到了这一点(但这篇文章已经过时了)

    从此改变你的演员界面:

    type IMyActor =
      inherit IActor
      abstract member GetCountAsync : unit -> Task<int>
      abstract member SetCountAsync : int -> Task
    

    以下内容:(注意 count 参数)

    type IMyActor =
      inherit IActor
      abstract member GetCountAsync : unit -> Task<int>
      abstract member SetCountAsync : count: int -> Task
    

    在此更改之后,您的示例对我来说效果很好。

    【讨论】:

      猜你喜欢
      • 2021-11-28
      • 1970-01-01
      • 2020-05-26
      • 1970-01-01
      • 2019-02-21
      • 1970-01-01
      • 2016-12-01
      • 2018-07-11
      • 2016-10-28
      相关资源
      最近更新 更多