【问题标题】:Windows Forms error in Linux environment on Raspberry PiRaspberry Pi 上 Linux 环境中的 Windows 窗体错误
【发布时间】:2013-02-09 07:04:16
【问题描述】:

我用 C# 开发了一个完全在 Windows 中运行的完整应用程序。我现在已经在 Linux 上安装了 mono(RPi 上的 Debian),并且正在执行该应用程序。

第一个表单(登录表单)加载得很好。在此表单上输入了用户详细信息,如果详细信息正确,则应关闭该表单并打开下一个。

以下代码来自登录表单,一旦我按下“登录”就会执行:

this.Hide();
Entry_System fm = new Entry_System();
fm.ShowDialog();
this.Show();

但是,在 Linux 中,表单刚刚关闭,并出现以下错误:

System.TypeLoadException:发生类型加载异常。 在 System.Windows.Forms.Control.OnClick (System.EventArgs e) [0x00000] 中:0 在 System.Windows.Forms.Button.OnClick (System.EventArgs e) [0x00000] 中:0 在 System.Windows.Forms.ButtonBase.OnMouseUp (System.Windows.Forms.MouseEventArgs 事件) [0x00000] in :0 在 System.Windows.Forms.Button.OnMouseUp (System.Windows.Forms.MouseEventArgs 事件) [0x00000] in :0 在 System.Windows.Forms.Control.WmLButtonUp (System.Windows.Forms.Message& m) [0x00000] 中:0 在 System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m) [0x00000] 中:0 在 System.Windows.Forms.ButtonBase.WndProc (System.Windows.Forms.Message& m) [0x00000] in :0 在 System.Windows.Forms.Button.WndProc (System.Windows.Forms.Message& m) [0x00000] 中:0 在 System.Windows.Forms.Control+ControlWindowTarget.OnMessage (System.Windows.Forms.Message& m) [0x00000] 在:0 在 System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Forms.Message& m) [0x00000] 在 :0 在 System.Windows.Forms.NativeWindow.WndProc (IntPtr hWnd, Msg msg, IntPtr wParam, IntPtr lParam) [0x00000] in :0

在 Windows 中,下一个表单会按预期打开。通过复选框选择的任一表单都是这种情况。

我已经运行了 apt-get update,apt-get mono complete,所以它们是最新版本。该应用程序是在 Windows 上编译的。我知道 mono 一直是一个很好的讨论主题,它在 Pi 上存在一些问题,但据我了解,像这样的基本功能在 Soft Float Debian 上应该可以正常工作。

【问题讨论】:

  • 可能是框架版本不匹配。

标签: c# linux winforms mono raspberry-pi


【解决方案1】:

您可能正在点击 this bug,这已在 Mono 3.0.3 中修复。

我不认为 apt-get 可以确保您获得这样一个新版本。您只需运行命令“mono --version”即可确认。

【讨论】:

  • "Mono 的当前发布版本是 2.10.8。(2011 年 12 月 19 日发布)描述 Mono 当前支持的最简单的方法是:.NET 4.0 中的所有内容,除了 WPF、WWF 和有限的 WCF。”从这里mono-project.com/Compatibility
  • 请升级到 Mono 3.x
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-11-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多