Skip to content

Instantly share code, notes, and snippets.

@fccm
Last active November 22, 2020 14:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fccm/cc196a2816b66b66463e425cf1e62adb to your computer and use it in GitHub Desktop.
Save fccm/cc196a2816b66b66463e425cf1e62adb to your computer and use it in GitHub Desktop.
compile .cs file from command line
$ cat hello.cs
using System;

public class HelloWorld
{
    public static void Main(string[] args)
    {
        Console.WriteLine("Hello Mono World");
    }
}

$ mcs -out:/tmp/hello.exe hello.cs

Unhandled Exception:
System.TypeInitializationException: The type initializer for
'System.Console' threw an exception. --->
System.TypeInitializationException: The type initializer for
'System.ConsoleDriver' threw an exception. ---> System.Exception:
Magic number is wrong: 542
  at System.TermInfoReader.ReadHeader (System.Byte[] buffer,
System.Int32& position) [0x0002b] in
<3bbfe271d04b46579d50b20b1414fdb1>:0
  at System.TermInfoReader..ctor (System.String term, System.String
filename) [0x00065] in <3bbfe271d04b46579d50b20b1414fdb1>:0
  at System.TermInfoDriver..ctor (System.String term) [0x00058] in
<3bbfe271d04b46579d50b20b1414fdb1>:0
  at System.ConsoleDriver.CreateTermInfoDriver (System.String term)
[0x00000] in <3bbfe271d04b46579d50b20b1414fdb1>:0
  at System.ConsoleDriver..cctor () [0x00062] in
<3bbfe271d04b46579d50b20b1414fdb1>:0
   --- End of inner exception stack trace ---
  at System.Console.SetupStreams (System.Text.Encoding inputEncoding,
System.Text.Encoding outputEncoding) [0x0000a] in
<3bbfe271d04b46579d50b20b1414fdb1>:0
  at System.Console..cctor () [0x000a8] in <3bbfe271d04b46579d50b20b1414fdb1>:0
   --- End of inner exception stack trace ---
  at Mono.CSharp.Driver.Main (System.String[] args) [0x00019] in
<aa714087e7c14824a3ec4908ee33182a>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException:
The type initializer for 'System.Console' threw an exception. --->
System.TypeInitializationException: The type initializer for
'System.ConsoleDriver' threw an exception. ---> System.Exception:
Magic number is wrong: 542
  at System.TermInfoReader.ReadHeader (System.Byte[] buffer,
System.Int32& position) [0x0002b] in
<3bbfe271d04b46579d50b20b1414fdb1>:0
  at System.TermInfoReader..ctor (System.String term, System.String
filename) [0x00065] in <3bbfe271d04b46579d50b20b1414fdb1>:0
  at System.TermInfoDriver..ctor (System.String term) [0x00058] in
<3bbfe271d04b46579d50b20b1414fdb1>:0
  at System.ConsoleDriver.CreateTermInfoDriver (System.String term)
[0x00000] in <3bbfe271d04b46579d50b20b1414fdb1>:0
  at System.ConsoleDriver..cctor () [0x00062] in
<3bbfe271d04b46579d50b20b1414fdb1>:0
   --- End of inner exception stack trace ---
  at System.Console.SetupStreams (System.Text.Encoding inputEncoding,
System.Text.Encoding outputEncoding) [0x0000a] in
<3bbfe271d04b46579d50b20b1414fdb1>:0
  at System.Console..cctor () [0x000a8] in <3bbfe271d04b46579d50b20b1414fdb1>:0
   --- End of inner exception stack trace ---
  at Mono.CSharp.Driver.Main (System.String[] args) [0x00019] in
<aa714087e7c14824a3ec4908ee33182a>:0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment