私は単純なコンパイラを開発しています.ILコードが生成された後の最後の段階は、クラッシュが発生しているilasm
ユーティリティでコンパイルすることです。ここでProcess.Startが例外なくクラッシュする
は、メソッドの完全なコードは(わずかスタック用に変更)です:
public static string ExecuteIL(string filename)
{
var ilasmp = new System.Diagnostics.Process();
ilasmp.StartInfo.FileName = "ilasm";
ilasmp.StartInfo.Arguments = filename;
//Crash does not happen here:
ilasmp.Start();
ilasmp.WaitForExit();
var p = new System.Diagnostics.Process();
p.StartInfo.FileName = "/usr/bin/time";
p.StartInfo.Arguments = "mono " + filename.Replace(".il", ".exe");
p.StartInfo.UseShellExecute = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
try{
//Crash happens HERE, but for some reason the exception does not get thrown
p.Start();
}
catch{
throw new Exception();
}
string output = p.StandardOutput.ReadToEnd();
p.WaitForExit();
return output;
}
ちょうどそれを明確にする:私は初めて(ilasmp.Start();
)のためProcess.Start
を呼び出したときにクラッシュが発生しませんが、なんらかの理由でこれが後で起こる(p.Start();
)、 、興味深いのは例外がスローされないということです。 つまり、コードがクラッシュするだけです。
? – knocte
@knocte、私はそれが最新バージョンの1つだと思います。ここにはモノラルバージョンからの正確な戻り値があります: 'Mono JITコンパイラバージョン4.2.4(tarball Fri Jun 10 10:12:47 UTC 2016)' –
何OS?どのようにモノのバージョンをインストールしましたか? – knocte