I get this error when I try to compile csharp or fsharp files. This happens when using gnome terminal or jetbrain rider.
It works fine in tty or termials like xterm and urxvt. Also I am able to compile c, c++ and go code.
Btw, I am using Arch/Antergos and got this issue yesterday.
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) [0x00028] in :0 at System.TermInfoReader..ctor (System.String term, System.String filename) [0x0005f] in :0 at System.TermInfoDriver..ctor (System.String term) [0x00055] in :0 at System.ConsoleDriver.CreateTermInfoDriver (System.String term) [0x00000] in :0 at System.ConsoleDriver..cctor () [0x0004d] in :0 --- End of inner exception stack trace --- at System.Console.SetupStreams (System.Text.Encoding inputEncoding, System.Text.Encoding outputEncoding) [0x00007] in :0 at System.Console..cctor () [0x0008e] in :0 --- End of inner exception stack trace --- at Mono.CSharp.Driver.Main (System.String[] args) [0x00019] in <2b1e99ce45b54209bdcdab138d9758ae>: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) [0x00028] in :0 at System.TermInfoReader..ctor (System.String term, System.String filename) [0x0005f] in :0 at System.TermInfoDriver..ctor (System.String term) [0x00055] in :0 at System.ConsoleDriver.CreateTermInfoDriver (System.String term) [0x00000] in :0 at System.ConsoleDriver..cctor () [0x0004d] in :0 --- End of inner exception stack trace --- at System.Console.SetupStreams (System.Text.Encoding inputEncoding, System.Text.Encoding outputEncoding) [0x00007] in :0 at System.Console..cctor () [0x0008e] in :0 --- End of inner exception stack trace --- at Mono.CSharp.Driver.Main (System.String[] args) [0x00019] in <2b1e99ce45b54209bdcdab138d9758ae>:0