问题描述
我正在尝试在 Linux 上的 Rider 中编译 C# Hello World 应用程序.当我尝试运行该应用程序时,我收到以下异常提示:
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:
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 <a84b655e5e6a49ee96b338ec792f5580>:0
at System.TermInfoReader..ctor (System.String term, System.String filename) [0x0005f] in <a84b655e5e6a49ee96b338ec792f5580>:0
at System.TermInfoDriver..ctor (System.String term) [0x00055] in <a84b655e5e6a49ee96b338ec792f5580>:0
at System.ConsoleDriver.CreateTermInfoDriver (System.String term) [0x00000] in <a84b655e5e6a49ee96b338ec792f5580>:0
at System.ConsoleDriver..cctor () [0x0004d] in <a84b655e5e6a49ee96b338ec792f5580>:0
--- End of inner exception stack trace ---
at System.Console.SetupStreams (System.Text.Encoding inputEncoding, System.Text.Encoding outputEncoding) [0x00007] in <a84b655e5e6a49ee96b338ec792f5580>:0
at System.Console..cctor () [0x0008e] in <a84b655e5e6a49ee96b338ec792f5580>:0
--- End of inner exception stack trace ---
at TestCaseApp.Program.Main (System.String[] args) [0x00001] in <662667bfa1e4443ea031df076247d2d3>: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 <a84b655e5e6a49ee96b338ec792f5580>:0
at System.TermInfoReader..ctor (System.String term, System.String filename) [0x0005f] in <a84b655e5e6a49ee96b338ec792f5580>:0
at System.TermInfoDriver..ctor (System.String term) [0x00055] in <a84b655e5e6a49ee96b338ec792f5580>:0
at System.ConsoleDriver.CreateTermInfoDriver (System.String term) [0x00000] in <a84b655e5e6a49ee96b338ec792f5580>:0
at System.ConsoleDriver..cctor () [0x0004d] in <a84b655e5e6a49ee96b338ec792f5580>:0
--- End of inner exception stack trace ---
at System.Console.SetupStreams (System.Text.Encoding inputEncoding, System.Text.Encoding outputEncoding) [0x00007] in <a84b655e5e6a49ee96b338ec792f5580>:0
at System.Console..cctor () [0x0008e] in <a84b655e5e6a49ee96b338ec792f5580>:0
--- End of inner exception stack trace ---
at TestCaseApp.Program.Main (System.String[] args) [0x00001] in <662667bfa1e4443ea031df076247d2d3>:0
我正在使用 Antergos (Linux) 和 JetBrains Rider 2017.3.1构建#RD-173.3994.2442我正在使用 Mono 5.4.1.7-2
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
我对这个错误做了一些研究,我发现:
I did some research about this bug and I found:
https://github.com/mono/mono/issues/6752#issuecomment-365212655
单编译器//终端模拟器问题
这些线程中提到的所有内容都没有帮助我解决这个问题.我能做什么?
Everything mentioned in these threads didn't help me to fix this issue. What can I do?
推荐答案
您没有按照该页面上的说明进行操作吗?您需要将 TERM
环境变量设置为 xterm
作为修复:
Did you not follow the instructions on that page? You need to set your TERM
environmental variable to xterm
as a fix:
export TERM=xterm
然后验证它是否已更改:
Then verify it is changed with:
echo $TERM
这篇关于Mono Bug:幻数错误:542的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!