[Mono-osx] Mono 1.1.18 - Console constructor fails while debugging - Workaround?

Pedro Gutierrez pgutierrez at etsii.upm.es
Wed Oct 25 11:16:20 EDT 2006


I upgraded to Mono 1.1.18 and discovered that it didn't work with  
XCode 2.4. As others have reported simple apps fail (while debugging)  
with the following error:

Unhandled Exception: System.TypeInitializationException: An exception  
was thrown by the type initializer for System.Console --->
System.NullReferenceException: Object reference not set to an  
instance of an object
    at System.TermInfoDriver.Init () [0x00000]
    at System.ConsoleDriver.Init () [0x00000]
    at System.Console..cctor () [0x00000] --- End of inner exception  
stack trace ---

    at <0x00000> <unknown method>
    at InstallTest.InstallTest.Main () [0x00000]
    at InstallTest.InstallTest.Main () [0x00000]

I found a workaround: in the app's properties set "Use pipe for  
standard input/ouptut" instead of the default "pseudo-terminal". Now  
it works! (at least on my Intel Mac).

There's another issue with the Console: I embed the mono runtime in a  
terminal app (written in C++) and calls to the Console.WriteLine  
method (in the mono domain) create problems in the unmanaged domain.  
Writing to cout still works, but reading from cin does not.

For example:
string command;
getline(cin, command);
cout << command;

When run in the terminal the command variable DOES store the user's  
input, but the terminal DOES NOT display the user's input while it is  
being entered if there has been a previous call to Console.WriteLine  
in the mono domain.

The app does work while debugging... only when run inside bash does  
it fail to work properly.

Any ideas???



More information about the Mono-osx mailing list