Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/186.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# StandardOutput.ReadToEnd()始终为空_C#_Android - Fatal编程技术网

C# StandardOutput.ReadToEnd()始终为空

C# StandardOutput.ReadToEnd()始终为空,c#,android,C#,Android,我对这个函数有问题。它应该向文本框输出安装命令,但install.StandardOutput.ReadToEnd()始终为null 我得到错误:表达式无法计算,因为调用堆栈顶部有一个本机帧 你能帮我解决这个问题吗 Process install = new Process(); install.StartInfo.FileName = "cmd.exe"; install.StartInfo.UseShellExecute = false; install.StartInfo.Argument

我对这个函数有问题。它应该向文本框输出安装命令,但
install.StandardOutput.ReadToEnd()
始终为
null


我得到错误:
表达式无法计算,因为调用堆栈顶部有一个本机帧

你能帮我解决这个问题吗

Process install = new Process();
install.StartInfo.FileName = "cmd.exe";
install.StartInfo.UseShellExecute = false;
install.StartInfo.Arguments = "/all";
install.StartInfo.CreateNoWindow = true;
install.StartInfo.RedirectStandardInput = true;
install.StartInfo.RedirectStandardOutput = true;
install.Start();

if (CB_MultiADB.Checked == true)
{
    install.StandardInput.WriteLine("FOR /F \"skip=1\" %%x IN ('adb devices') DO start cmd.exe @cmd /k" + InstallOption + InstallPfad + "\"");
}
else
{
    install.StandardInput.WriteLine("adb install" + InstallOption + InstallPfad + "\"");

    InstallAusgabe = install.StandardOutput.ReadToEnd();
    string Index = "adb install";
    int Indexnr = InstallAusgabe.IndexOf(Index);
    string SubInstall = InstallAusgabe.Substring(Indexnr, 100);
    TB_Ausgabe.Text = SubInstall;
}

无法计算表达式,因为调用堆栈顶部有一个本机帧这是使用调试器时通常看到的。您是否尝试在调试器之外运行应用程序?它是如何运行的?您可能还对阅读它的崩溃、无法关闭和根本不响应感兴趣,即使在调试器之外也是如此。我在代码的另一部分中使用了几乎相同的函数,这似乎不是问题。它是否仅在
CB_MultiADB.Checked==true时崩溃,或者您能否在更简单的分支中重现该行为?2.应用程序崩溃-它是否引发您可以登录到try catch的任何异常?如果它真的很难崩溃,那么还有一些方法-3。您是否尝试过用一些标准或虚拟应用程序而不是adb来重现这种行为?1。当
CB_MultiADB.Checked==true时,它不会崩溃。我可以捕捉到任何异常,它似乎很难崩溃,但是
procdump-e
没有抛出任何关于错误3的信息。是的,由于
StandardOutput.ReadToEnd()
为空,虚拟应用程序也会崩溃