一串包含=>;中的结果;HRESULT:0x80070002

本文关键字:结果 HRESULT 0x80070002 gt 一串 包含 | 更新日期: 2023-09-27 18:29:08

Sitrep:我有一个解析函数,可以将数组中的许多文本解析为值。我连续几次进行相同的解析,前3次成功,而最后两次在我尝试构建时在Xamarin中抛出错误。我已经看了好几次了,不知道他们出了什么问题。

错误:

System.IO.FileNotFoundException: The system cannot find the file specified. (Exception from HRESULT: 0x80070002)
at Microsoft.Samples.Debugging.CorDebug.NativeApi.ICorDebug.CreateProcess(String lpApplicationName, String lpCommandLine, SECURITY_ATTRIBUTES lpProcessAttributes, SECURITY_ATTRIBUTES lpThreadAttributes, Int32 bInheritHandles, UInt32 dwCreationFlags, IntPtr lpEnvironment, String lpCurrentDirectory, STARTUPINFO lpStartupInfo, PROCESS_INFORMATION lpProcessInformation, CorDebugCreateProcessFlags debuggingFlags, ICorDebugProcess& ppProcess)
at Microsoft.Samples.Debugging.CorDebug.CorDebugger.CreateProcess(String applicationName, String commandLine, SECURITY_ATTRIBUTES processAttributes, SECURITY_ATTRIBUTES threadAttributes, Boolean inheritHandles, Int32 creationFlags, IntPtr environment, String currentDirectory, STARTUPINFO startupInfo, PROCESS_INFORMATION& processInformation, CorDebugCreateProcessFlags debuggingFlags)
at Microsoft.Samples.Debugging.CorDebug.CorDebugger.CreateProcess(String applicationName, String commandLine, String currentDirectory, IDictionary`2 environment, Int32 flags)
at MonoDevelop.Debugger.Win32.CorDebuggerSession.<>c__DisplayClass5.<OnRun>b__4()
at MonoDevelop.Debugger.Win32.MtaThread.Run(Action ts)
at MonoDevelop.Debugger.Win32.CorDebuggerSession.OnRun(DebuggerStartInfo startInfo)
at Mono.Debugging.Client.DebuggerSession.<>c__DisplayClass11.<Run>b__f()

现在,我已经查看了这个错误,并阅读了它,但我对它的理解还不够,无法对其进行任何修改。对我来说,Xamarin似乎找不到调试构建所需的文件,所以我尝试在Xamarin上进行修复安装,但无济于事。

守则

for (int i = 0; i < lines.Length; i++) {
        string s = lines[i];
        bool p;
// Some other parsing stuff
        else if (s.Contains("Melee:")) {
            int myMelee;
            p = int.TryParse(s.Replace("Melee:", "").Trim(), out myMelee);
            currentMek.melee = myMelee;
            mekMelee.Value = currentMek.melee;
        }
        else if (s.Contains("Guns:")) {
            int myGuns;
            p = int.TryParse(s.Replace("Guns:", "").Trim(), out myGuns);
            currentMek.guns = myGuns;
            mekGuns.Value = currentMek.guns;
        }
        else if (s.Contains("Cannons:")) {
            int myCannons;
            p = int.TryParse(s.Replace("Cannons:", "").Trim(), out myCannons);
            currentMek.cannons = myCannons;
            mekCannons.Value = currentMek.cannons;
        }
        //causing problems from here down
        else if (s.Contains("Missiles:")) {
            int myMissiles;
            p = int.TryParse(s.Replace("Missiles:", "").Trim(), out myMissiles);
            currentMek.missiles = myMissiles;
            mekMissiles.Value = currentMek.missiles;
        }
        else if (s.Contains("Rockets:")) {
            int myRockets;
            p = int.TryParse(s.Replace("Rockets:", "").Trim(), out myRockets);
            currentMek.rockets = myRockets;
            mekRockets.Value = currentMek.rockets;
        }
}

如果我删除或注释掉最后两个If elses,一切都很好。为什么?

一串包含=>;中的结果;HRESULT:0x80070002

我认为您的数组中有一些错误,请尝试检查您要查找的行是否真的在您的阵列中,错误可能是针对ArrayOutOfIndex,因为visual studio多次错误地返回错误,主要是在VS2012中。正在等待您的答复。