1

Sitrep: I've got a parsing function that parses a number of texts in an array to values. I do the same kind of parsing several times in a row, and the first 3 work, while the last two throw errors in Xamarin when I try to build. I've been over it several times, and can't figure out what's wrong with them.

The Error:

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()

Now I've looked through this error, and I've read it, but I don't understand enough of it to make anything of it. To me, it looks like Xamarin can't find a file it needs to debug the build, so I tried a repair install on Xamarin, but that didn't help.

The Code

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 I remove or comment out the last two if elses, all is well. Why is that?

4

1 回答 1

0

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

于 2013-08-27T19:05:29.063 回答