2016-11-13 59 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 

這個改變後,你的例子對我來說工作得很好。