我试图将带有“角色服务”的“服务结构应用程序”的默认模板从C#转换为F#。
这是github repo。
我可以编译所有内容,但是当我将其部署到本地群集时,我会得到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.
最佳答案
您的问题非常微妙。我自己偶然发现了这个。
actor界面中的每个参数都必须具有显式名称。感谢艾萨克·亚伯拉罕(Isaac Abraham)在他的blog post中提到了这一点(但是这篇帖子非常过时)
从此更改您的actor界面:
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
更改之后,您的示例对我来说效果很好。
关于c# - F#的Service Fabric无法正常工作,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/40571669/