Frage

I am trying to run on Monodevelop (latest Git) a solution that runs fine on Xamarin.Mac

It crashes at the base() line:

public class SetupWindow : NSWindow {

    public List <NSButton> Buttons = new List <NSButton> ();
    public string Header;
    public string Description;
    private NSImage side_splash;
    private NSImageView side_splash_view;
    private NSTextField header_text_field;
    private NSTextField description_text_field;

    public SetupWindow () : base ()
    {
        SetFrame (new RectangleF (0, 0, 640, 420), true);

With this output:

2014-02-06 18:05:28.567 mono[8564:507] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error (1000) creating CGSWindow on line 263'
*** Call stack at first throw:
(
0   CoreFoundation                      0x927956b1 __raiseError + 193
1   libobjc.A.dylib                     0x96f38091 objc_exception_throw + 162
2   CoreFoundation                      0x927955cb +[NSException raise:format:] + 139
3   AppKit                              0x97f434b3 _NSCreateWindowWithOpaqueShape2 + 1718
4   AppKit                              0x97f41f3a -[NSWindow _commonAwake] + 4391
5   AppKit                              0x97e167fb -[NSWindow _commonInitFrame:styleMask:backing:defer:] + 864
6   AppKit                              0x97e15de3 -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 1090
7   AppKit                              0x97e1599a -[NSWindow initWithContentRect:styleMask:backing:defer:] + 70
8   AppKit                              0x9860919a -[NSWindow init] + 107
9   ???                                 0x02a01d22 0x0 + 44047650
10  ???                                 0x04095ebc 0x0 + 67722940
11  ???                                 0x04095108 0x0 + 67719432
12  ???                                 0x02a02c34 0x0 + 44051508
13  ???                                 0x029fec8c 0x0 + 44035212
14  ???                                 0x02296b84 0x0 + 36268932
15  ???                                 0x02296e9f 0x0 + 36269727
16  mono                                0x0007b2ee mono_jit_runtime_invoke + 798
17  mono                                0x0023500e mono_runtime_invoke + 126
18  mono                                0x002395c4 mono_runtime_exec_main + 420
19  mono                                0x00239935 mono_runtime_run_main + 725
20  mono                                0x000e68d5 mono_jit_exec + 149
21  mono                                0x000e8f12 mono_main + 9778
22  mono                                0x0006e9fe main + 558
23  mono                                0x0006e7c5 start + 53

Any idea what is going wrong?

Because of another problem, I commented out the lines that set images for NSApplication.SharedApplication.ApplicationIconImage and NSWorkspace.SharedWorkspace.SetIconforFile, could that be the problem?

A colleague tried on his brand new Mac, and gets the exact same problem.

War es hilfreich?

Lösung

The problem was fixed by adding these two lines before instantiating SetupWindow:

NSApplication.SharedApplication.ApplicationIconImage = image;
SetFolderIcon ();

Now the application runs fine.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top