System.Windows.Forms.XplatUICarbon.CGDisplayBounds在MacOS上运行简单mono应用程序时出错

System.Windows.Forms.XplatUICarbon.CGDisplayBounds在MacOS上运行简单mono应用程序时出错,macos,mono,macports,Macos,Mono,Macports,在Mac OS X上尝试运行简单的Mono应用程序时,我遇到了以下问题: Stacktrace: at (wrapper managed-to-native) System.Windows.Forms.XplatUICarbon.CGDisplayBounds (intptr) <0xffffffff> at System.Windows.Forms.XplatUICarbon.get_WorkingArea () <0x00035> 编撰 mcs te

在Mac OS X上尝试运行简单的Mono应用程序时,我遇到了以下问题:

Stacktrace:
      at (wrapper managed-to-native) System.Windows.Forms.XplatUICarbon.CGDisplayBounds (intptr) <0xffffffff>
  at System.Windows.Forms.XplatUICarbon.get_WorkingArea () <0x00035>
编撰

mcs test.cs-r:System.Windows.Forms.dll-r:System.Drawing.dl

它将o.k.编译为test.exe。试着把它当作

mono test.exe

然后指向上面的stacktrace。 论坛帖子中提到了该问题,网址为:

我能够在以下环境中完全复制它:

  • Mac OS 10.7.5
  • Mac端口2.2.0
  • Mono 2.10.9
错误报告在

可能与此问题稍有关联,因为需要配置和 在这个bug报告中提到,Mono Cairo和Xquartz合作的方式可能存在问题:


现在,如果您知道如何在不必等待错误报告(9年前…)修复的情况下使其正常工作,那就太好了。

似乎在说:“Mono对System.Windows.Forms API的实现构建在Carbon之上,只能在32位系统上与Mono一起运行。System.Windows.Forms应用程序的外观模仿Windows样式,当前呈现方式与本机OSX应用程序不同。“从并运行/Library/Frameworks/mono.framework/Commands/mono test.exe安装最新的mono运行正常(用于比较)
using System.Windows.Forms;

class test {

        public static void Main() {
                Form fm1 = new Form();
                TextBox Tb1 = new TextBox();
                Tb1.Text="text";
                Tb1.Location = new System.Drawing.Point(10,10);
                Tb1.Size=new System.Drawing.Size(80,20);

                fm1.Controls.Add(Tb1);
                Application.Run(fm1);
        }
}