Search code examples
c#.netmonomonomac

Mono command line program dies with "trace trap" message and nothing else


I have a command line Mono application running on the Mac (OSX Lion) and it dies misteriously with the following message:

[1]    53342 trace trap  "/Library/Frameworks/Mono.framework/Versions/2.10.9/bin/mono" --debug  

read: -p: no coprocess

This is running the app from MonoDevelop.

Anyone has any idea what is happening and how I can fix this? (or how I can try to figure out what it is)


Solution

  • In the end the issue was that there was code like this in the app:

    #if DEBUG
        Debugger.Break();
    #endif
    

    The application was being compiled in Debug and I was running the app like this:

    mono Cli.exe
    

    And when the interpreter found this piece of code, there was no debugger available when the trap signal was sent. While on Windows a dialog is opened asking you if you want to debug the app, on MacOS the application just commits suicide. The fix was to not execute this code if running on a Mac (or running the app inside of GDB).