这个 Akka.NET 代码有什么问题?

Sol*_*lma 3 f# akka akka.net

我花了一些时间搜索 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()
Run Code Online (Sandbox Code Playgroud)

异常消息包括以下内容:

System.TypeLoadException: Method 'WatchWith' in type '-ctor@270' from assembly 'Akka.FSharp, Version=1.2.3.41, Culture=neutral, PublicKeyToken=null' does not have an implementation

Bar*_*ski 5

WatchWith方法已在 Akka.NET v1.3 中引入,而您使用的是 Akka.FSharp v1.2.3。您需要将 Akka 依赖项降级回 1.2.3(此时 Akka.FSharp 在 v1.3 中尚不可用)。