在 vps debian System.MissingMethodException 上尝试 运行 steambot 时出错:找不到方法:'System.Array.Empty'

Error when trying to run steambot on vps debian System.MissingMethodException: Method not found: 'System.Array.Empty'

我在 windows 上使用 modevelop 构建了解决方案,然后使用 Filezilla 将文件传输到我的 vps。它在 windows 上运行良好。但是当我尝试使用 mono steambot.exe 运行 steambot 时,我得到了错误:

Unhandled Exception: System.MissingMethodException: Method not found: 'System.Array.Empty'.
  at SteamBot.Program.BotManagerMode () [0x00000] in <filename unknown>:0
  at SteamBot.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.MissingMethodException: Method not found: 'System.Array.Empty'.
  at SteamBot.Program.BotManagerMode () [0x00000] in <filename unknown>:0
  at SteamBot.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
mattimat@mattimat-ubuntu:~/steambot/SteamBot-master/Bin/Release$ mono SteamBot.exe
Missing method System.Array::Empty<[1]>() in assembly /usr/lib/mono/4.0/mscorlib.dll, referenced in assembly /home/mattimat/steambot/SteamBot-master/Bin/Release/SteamBot.exe

Unhandled Exception: System.MissingMethodException: Method not found: 'System.Array.Empty'.
  at SteamBot.Program.BotManagerMode () [0x00000] in <filename unknown>:0
  at SteamBot.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.MissingMethodException: Method not found: 'System.Array.Empty'.
  at SteamBot.Program.BotManagerMode () [0x00000] in <filename unknown>:0
  at SteamBot.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
mattimat@mattimat-ubuntu:~/steambot/SteamBot-master/Bin/Release$

单声道版本:

Mono JIT compiler version 2.10.8.1 (Debian 2.10.8.1-8+deb7u1)
Copyright (C) 2002-2011 Novell, Inc, Xamarin, Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       altstack
        Notifications: epoll
        Architecture:  x86
        Disabled:      none
        Misc:          softdebug
        LLVM:          supported, not enabled.
        GC:            Included Boehm (with typed GC and Parallel Mark)

同样,在 windows 上运行良好。 VPS 是 Debian 7.11 x32

public static T[] System.Array.Empty<T>() 已添加到 .Net 4.6 中,因此您的旧版本 Mono 将是 运行 .Net 4.5,并且会出现错误。

要么将您的 Mono 版本更新到 4.8+,要么删除 Array.Empty 的使用并针对 .Net 4.5 框架进行编译。

回复:https://msdn.microsoft.com/en-us/library/dn906179(v=vs.110).aspx