C# 字符串。包含=>HRESULT:0x80070002中的结果

C# 字符串。包含=>HRESULT:0x80070002中的结果,c#,build,mono,xamarin,C#,Build,Mono,Xamarin,Sitrep:我有一个解析函数,可以将数组中的大量文本解析为值。我连续几次执行相同类型的解析,前3次有效,而最后两次在尝试构建时在Xamarin中抛出错误。我已经检查过好几次了,都不知道他们怎么了 错误: 现在我已经看完了这个错误,我也读过了,但我对它的理解还不够透彻。在我看来,Xamarin似乎找不到调试构建所需的文件,因此我尝试在Xamarin上进行修复安装,但没有任何帮助 代码 如果我删除或注释掉最后两个If elses,一切都很好。为什么会这样?我认为您的数组中有一些错误,请尝试检查您要

Sitrep:我有一个解析函数,可以将数组中的大量文本解析为值。我连续几次执行相同类型的解析,前3次有效,而最后两次在尝试构建时在Xamarin中抛出错误。我已经检查过好几次了,都不知道他们怎么了

错误: 现在我已经看完了这个错误,我也读过了,但我对它的理解还不够透彻。在我看来,Xamarin似乎找不到调试构建所需的文件,因此我尝试在Xamarin上进行修复安装,但没有任何帮助

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

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

错误是在哪一行抛出的?在我构建项目时,它是作为异常抛出的,但Xamarin没有告诉我具体在哪里或什么地方。我已经找到了s.ContainsMissiles:,只要if语句是空的。有时,如果我将字符串smissions:更改为其他内容,例如Miss,则它将起作用,但前提是if语句为空。它似乎与mono中的string.Contains和string.Replace方法有关,我猜?你试过在没有调试器的情况下运行代码吗?不,我真的没有想到。我想你的意思是像发布版本而不是调试版本?我来试一试。好吧,发布版本可以工作,但调试不能?这到底是怎么回事?我该如何修复它呢?我使用的是Xamarin而不是VS,我专门创建了一个数组,它太大了,无法保存我的数据。我只输入了13个字符串,但条目的长度被初始化为20。
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()
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;
        }
}