简体   繁体   English

单声道System.TypeLoadException

[英]Mono System.TypeLoadException

I have created a C# Socket server and when i try to run it on Linux (have Mono Runtime installed) i get this exception every time the socket initializes 我创建了一个C#套接字服务器,当我尝试在Linux上运行它(安装了Mono Runtime)时,每次套接字初始化时都会收到此异常

System.TypeLoadException: Could not load type 'System.Runtime.CompilerServices.IAsyncStateMachine' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

Project Information: 项目信息:

  • Target Framework: .Net 4.5 . 目标框架: .Net 4.5
  • Type: Console Application . 类型: Console Application
  • External Dependencies: None . 外部依赖性: None
  • Compiled Using: Normal Visual Studio Compiler . 编译使用: Normal Visual Studio Compiler

Note: This only happens on Linux Ubuntu , while working fine on windows. 注意:这仅在Linux Ubuntu上发生,而在Windows上可以正常工作。

Default references in Visual Studio and MonoDevelop/Xamarin Studio are different. Visual Studio和MonoDevelop / Xamarin Studio中的默认引用是不同的。 mscorlib should always be referenced, but I think compiling the project in Linux host would make it work: $ cd /path/to/source $ xbuild $ mono bin/your.exe 应该始终引用mscorlib ,但是我认为在Linux主机中编译该项目可以使其工作: $ cd /path/to/source $ xbuild $ mono bin/your.exe

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM