2016-11-13 62 views
4

我尝试将“服务结构Applicatoin”的默认模板与“Actor服务”从C#转换为F#。F#不起作用的服务结构

这里是github repo

我可以编译一切,但是当我将它部署到本地集群时,我得到了System.ArgumentNullException。 Anyoune知道这里有什么问题吗?

这里是堆栈跟踪(这是德语,不好意思):

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. 

回答

3

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

参与者接口中的每个参数都必须有一个明确的名称。感谢谁在他的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 

这个改变后,你的例子对我来说工作得很好。