title: Mono Bug : Magic number is wrong: 542
body: <p>I am trying to compile a C# Hello World application in Rider on Linux.
  When I try to run the app, I am promted the following exception:</p>
  
  <pre><code>Unhandled Exception:
  System.TypeInitializationException: The type initializer for 'System.Console' threw an exception. ---&gt; System.TypeInitializationException: The type initializer for 'System.ConsoleDriver' threw an exception. ---&gt; System.Exception: Magic number is wrong: 542
  at System.TermInfoReader.ReadHeader (System.Byte[] buffer, System.Int32&amp; position) [0x00028] in &lt;a84b655e5e6a49ee96b338ec792f5580&gt;:0
  at System.TermInfoReader..ctor (System.String term, System.String filename) [0x0005f] in &lt;a84b655e5e6a49ee96b338ec792f5580&gt;:0
  at System.TermInfoDriver..ctor (System.String term) [0x00055] in &lt;a84b655e5e6a49ee96b338ec792f5580&gt;:0
  at System.ConsoleDriver.CreateTermInfoDriver (System.String term) [0x00000] in &lt;a84b655e5e6a49ee96b338ec792f5580&gt;:0
  at System.ConsoleDriver..cctor () [0x0004d] in &lt;a84b655e5e6a49ee96b338ec792f5580&gt;:0
  --- End of inner exception stack trace ---
  at System.Console.SetupStreams (System.Text.Encoding inputEncoding, System.Text.Encoding outputEncoding) [0x00007] in &lt;a84b655e5e6a49ee96b338ec792f5580&gt;:0
  at System.Console..cctor () [0x0008e] in &lt;a84b655e5e6a49ee96b338ec792f5580&gt;:0
  --- End of inner exception stack trace ---
  at TestCaseApp.Program.Main (System.String[] args) [0x00001] in &lt;662667bfa1e4443ea031df076247d2d3&gt;:0
  [ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: The type initializer for 'System.Console' threw an exception. ---&gt; System.TypeInitializationException: The type initializer for 'System.ConsoleDriver' threw an exception. ---&gt; System.Exception: Magic number is wrong: 542
  at System.TermInfoReader.ReadHeader (System.Byte[] buffer, System.Int32&amp; position) [0x00028] in &lt;a84b655e5e6a49ee96b338ec792f5580&gt;:0
  at System.TermInfoReader..ctor (System.String term, System.String filename) [0x0005f] in &lt;a84b655e5e6a49ee96b338ec792f5580&gt;:0
  at System.TermInfoDriver..ctor (System.String term) [0x00055] in &lt;a84b655e5e6a49ee96b338ec792f5580&gt;:0
  at System.ConsoleDriver.CreateTermInfoDriver (System.String term) [0x00000] in &lt;a84b655e5e6a49ee96b338ec792f5580&gt;:0
  at System.ConsoleDriver..cctor () [0x0004d] in &lt;a84b655e5e6a49ee96b338ec792f5580&gt;:0
  --- End of inner exception stack trace ---
  at System.Console.SetupStreams (System.Text.Encoding inputEncoding, System.Text.Encoding outputEncoding) [0x00007] in &lt;a84b655e5e6a49ee96b338ec792f5580&gt;:0
  at System.Console..cctor () [0x0008e] in &lt;a84b655e5e6a49ee96b338ec792f5580&gt;:0
  --- End of inner exception stack trace ---
  at TestCaseApp.Program.Main (System.String[] args) [0x00001] in &lt;662667bfa1e4443ea031df076247d2d3&gt;:0
  </code></pre>
  
  <p>I am using Antergos (Linux) and JetBrains Rider 2017.3.1
  Build #RD-173.3994.2442
  I have am using Mono 5.4.1.7-2</p>
  
  <p>I did some research about this bug and I found:</p>
  
  <p><a href="https://github.com/mono/mono/issues/6752#issuecomment-365212655" rel="noreferrer">https://github.com/mono/mono/issues/6752#issuecomment-365212655</a></p>
  
  <p><a href="https://stackoverflow.com/questions/48886689/mono-compiler-terminal-emulator-issue">Mono compiler // Terminal emulator issue</a></p>
  
  <p>Everything mentioned in these threads didn't help me to fix this issue. What can I do?</p>