gpt4 book ai didi

c# - 带有 F# 的 Service Fabric 不工作

转载 作者:太空狗 更新时间:2023-10-29 23:20:39 24 4
gpt4 key购买 nike

我尝试将带有“Actor Service”的“Service Fabric Applicatoin”的默认模板从 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 接口(interface)中的每个参数都必须有一个显式 名称。感谢 Isaac Abraham 在他的 blog post 中提到了这一点(但是这个帖子已经很过时了)

从此改变你的 Actor 界面:

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

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

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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com