2013-08-27 2 views
1

Sitrep : 배열에있는 여러 텍스트를 값으로 구문 분석하는 구문 분석 함수가 있습니다. 나는 같은 종류의 파싱을 여러 번 연속적으로 수행하며 처음 세 가지 작업을 수행합니다. 마지막 두 작업은 Xamarin에서 오류를 발생시키는 반면 빌드하려고 시도합니다. 나는 여러 번 그것에 걸쳐 있었고, 그들에게 무엇이 잘못되었는지를 알 수 없다.문자열. 결과를 => HRESULT : 0x80070002

오류 :
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에서 복구를 시도했지만 도움이되지 않았습니다. 내가 제거하거나 마지막 두 elses의 경우 주석 경우

강령

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; 
     } 
} 

는, 모두 잘 있습니다. 왜 그런가요?

+1

어떤 줄에서 오류가 발생합니까? – paqogomez

+0

프로젝트를 빌드 할 때 예외로 던져 지지만 Xamarin은 어디서 무엇을 정확하게 말하지 않습니다. if 문이 비어있는 한 "s.Contains ("Missiles : ")로 추적했습니다."Missile : "문자열을"Miss "와 같은 다른 것으로 변경하면 가끔 작동합니다. , if 문이 비어있는 경우에만. 그것은 string.Contains 및 string.Lplace 메서드를 모노와 관련이있는 것으로 보입니다. – Arcandio

+0

디버거없이 코드를 실행 해 보셨습니까? –

답변

0

배열에 오류가있는 것 같습니다. 찾고있는 행이 실제로 배열에 있는지 확인하십시오. ArrayOutOfIndex 여러 번 Visual Studio에서 오류가 대부분 잘못 반환되기 때문에 오류가있을 수 있습니다. VS2012. 당신의 응답을 기다리는.

+0

VS 대신 Xamarin을 사용하고 있으며 보유 할 수없는 배열을 만듭니다. 내 데이터. 나는 13 개의 문자열 만 넣었지 만 항목은 시작입니다. 20의 길이로 alized. – Arcandio

관련 문제