gpt4 book ai didi

f# - 这段 Akka.NET 代码有什么问题?

转载 作者:行者123 更新时间:2023-12-03 04:34:24 26 4
gpt4 key购买 nike

我花了一些时间搜索 Akka.NET F# API。尽管有很好的 C# 文档,但找不到它。我找到了下面的代码,日期为 2017 年 3 月,看起来不错,但不幸的是,当我尝试运行它时,生成了一个异常。

两个问题:

1)下面的代码有什么问题?

2) 是否有 Akka.Net F# API 的在线文档?如果有,它在哪里?

观察:我尝试了在网上找到的其他几个 F# Akka.NET 片段,它们都生成了异常。

代码的 URL 是:

https://www.seventeencups.net/building-a-mud-with-f-sharp-and-akka-net-part-one/

这是我尝试运行的代码:

open System
open Akka.Actor
open Akka.Configuration
open Akka.Remote
open Akka.FSharp

let system = System.create "system" (Configuration.defaultConfig())

type GreeterMsg =
| Hello of string
| Goodbye of string

let greeter = spawn system "greeter" <| fun mailbox ->
let rec loop() = actor {
let! msg = mailbox.Receive()

match msg with
| Hello name -> printf "Hello, %s!\n" name
| Goodbye name -> printf "Goodbye, %s!\n" name

return! loop()
}
loop()

异常消息包括以下内容:

System.TypeLoadException:程序集“Akka.FSharp,Version=1.2.3.41,Culture=neutral,PublicKeyToken=null”中类型“-ctor@270”中的方法“WatchWith”没有实现

最佳答案

当您使用 Akka.FSharp v1.2.3 时,Akka.NET v1.3 中引入了

WatchWith 方法。您需要将 Akka 依赖项降级回 1.2.3(此时 Akka.FSharp 在 v1.3 中尚不可用)。

关于f# - 这段 Akka.NET 代码有什么问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45906694/

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