none
Loop Stops with First Chance Exception Type 'ArgumentOutOfRangeException'

    Question

  • This has got me puzzled.
    I am comparing two files, line by line. The loop is going as it's expected to, until...
    first chance exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll
    I don't understand why, since the line being read, is shorter than the previous. ...need help on this one.

    .....
    Reading line in A      3/21/2016 4:57:22 PM
    Reading line in B      3/21/2016 4:57:22 PM
    A and B are the same. Back to A
    Reading line in A      3/21/2016 4:57:22 PM
    Reading line in B      3/21/2016 4:57:22 PM
    A and B are the same. Back to A
    Reading line in A      3/21/2016 4:57:22 PM
    Reading line in B      3/21/2016 4:57:22 PM
    A and B are the same. Back to A
    Reading line in A      3/21/2016 4:57:22 PM
    Reading line in B      3/21/2016 4:57:22 PM
    A and B are the same. Back to A
    Reading line in A      3/21/2016 4:57:22 PM
    Reading line in B      3/21/2016 4:57:22 PM
    A and B are the same. Back to A
    Reading line in A      3/21/2016 4:57:22 PM
    Reading line in B      3/21/2016 4:57:22 PM
    A and B are the same. Back to A
    Reading line in A      3/21/2016 4:57:22 PM
    Reading line in B      3/21/2016 4:57:22 PM
    A and B are the same. Back to A
    Reading line in A      3/21/2016 4:57:22 PM
    Reading line in B      3/21/2016 4:57:22 PM
    A and B are the same. Back to A
    Reading line in A      3/21/2016 4:57:22 PM
    Reading line in B      3/21/2016 4:57:22 PM
    A and B are the same. Back to A
    Reading line in A      3/21/2016 4:57:22 PM
    Reading line in B      3/21/2016 4:57:22 PM
    A and B are the same. Back to A
    Reading line in A      3/21/2016 4:57:22 PM
    Reading line in B      3/21/2016 4:57:22 PM
    A and B are the same. Back to A
    Reading line in A      3/21/2016 4:57:22 PM
    Reading line in B      3/21/2016 4:57:22 PM
    A and B are the same. Back to A
    Reading line in A      3/21/2016 4:57:22 PM
    Reading line in B      3/21/2016 4:57:22 PM
    A and B are the same. Back to A
    Reading line in A      3/21/2016 4:57:22 PM
    Reading line in B      3/21/2016 4:57:22 PM
    A and B are the same. Back to A
    Reading line in A      3/21/2016 4:57:22 PM
    Reading line in B      3/21/2016 4:57:22 PM
    A and B does not match. Finding out what changed 
     | C:\Program Files\Andy\7za-x64.exe 
     | C:\Program Files\Andy\7za-x64.exe 
    1.014 MB
    1.021 MB
    record change
    Reading line in A      3/21/2016 4:57:22 PM
    Reading line in B      3/21/2016 4:57:22 PM
    A and B does not match. Finding out what changed 
     | C:\Program Files\Andy\adb.exe 
     | C:\Program Files\Andy\adb.exe 
    803.516 KB
    934.797 KB
    record change
    Reading line in A      3/21/2016 4:57:22 PM
    Reading line in B      3/21/2016 4:57:22 PM
    A and B are the same. Back to A
    Reading line in A      3/21/2016 4:57:22 PM
    Reading line in B      3/21/2016 4:57:22 PM
    A and B are the same. Back to A
    Reading line in A      3/21/2016 4:57:22 PM
    Reading line in B      3/21/2016 4:57:22 PM
    A and B does not match. Finding out what changed 
     | C:\Program Files\Andy\Andy.exe 
     | C:\Program Files\Andy\Andy.exe 
    15.562 MB
    1.681 MB
    record change
    Reading line in A      3/21/2016 4:57:22 PM
    Reading line in B      3/21/2016 4:57:22 PM
    A and B does not match. Finding out what changed 
     | C:\Program Files\Andy\AndyFolderIcon.ico 
     | C:\Program Files\Andy\AndyADB.exe 
    361.396 KB
    850.297 KB
    recheck 1 -  | C:\Program Files\Andy\AndyADB.exe / 870704 bytes // 850.297 KB
    match is False - back to A
    Reading line in A      3/21/2016 4:57:22 PM
    Reading line in B      3/21/2016 4:57:22 PM
    A and B does not match. Finding out what changed 
     | C:\Program Files\Andy\AndyIcon.ico 
     | C:\Program Files\Andy\AndyAPK.exe 
    44.964 KB
    848.797 KB
    recheck 2 -  | C:\Program Files\Andy\AndyAPK.exe / 869168 bytes // 848.797 KB
    match is False - back to A
    Reading line in A      3/21/2016 4:57:22 PM
    Reading line in B      3/21/2016 4:57:22 PM
    A and B does not match. Finding out what changed 
     | C:\Program Files\Andy\AndyIcon16.ico 
     | C:\Program Files\Andy\AndyConsole.exe 
    1.123 KB
    20.348 MB
    recheck 3 -  | C:\Program Files\Andy\AndyConsole.exe / 21336952 bytes // 20.348 MB
    match is False - back to A
    Reading line in A      3/21/201A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll
    The thread 0x5d1c has exited with code 0 (0x0).
    The thread 0x5ad0 has exited with code 0 (0x0).
    6 4:57:22 PM
    Reading line in B      3/21/2016 4:57:23 PM
    A and B does not match. Finding out what changed 
     | C:\Program Files\Andy\dash.png 
     | C:\Program Files\Andy\AndyDnD.exe 
    The thread 0x5114 has exited with code 259 (0x103).
    • Changed type JohnG1000 Tuesday, March 22, 2016 9:24 AM
    Monday, March 21, 2016 10:44 PM

Answers

  • Hi JohnG1000,

    Could you please share some code for your loop? It can help us understanding your problem and reproduce it in our side to find out what happened with your code.

    According to the exception of "System.ArgumentOutOfRangeException", this error often occurs when your code operations out of the range that you operated. Please debug the read method in your code step by step to check whether it out of the range in one of the loop.

    In addition, this forum is discuss Visual Studio WPF/SL Designer, Visual Studio Guidance Automation Toolkit, Developer Documentation and Help System, and Visual Studio Editor.

    Your problem should be more related to your code, so we need to know what language you are using, which can let us help you move this thread to a appropriate forum for a better help.

    Best Regards,
    Weiwei

    • Marked as answer by JohnG1000 Thursday, March 24, 2016 10:48 AM
    Wednesday, March 23, 2016 5:22 AM
    Moderator

All replies

  • Hi JohnG1000,

    Could you please share some code for your loop? It can help us understanding your problem and reproduce it in our side to find out what happened with your code.

    According to the exception of "System.ArgumentOutOfRangeException", this error often occurs when your code operations out of the range that you operated. Please debug the read method in your code step by step to check whether it out of the range in one of the loop.

    In addition, this forum is discuss Visual Studio WPF/SL Designer, Visual Studio Guidance Automation Toolkit, Developer Documentation and Help System, and Visual Studio Editor.

    Your problem should be more related to your code, so we need to know what language you are using, which can let us help you move this thread to a appropriate forum for a better help.

    Best Regards,
    Weiwei

    • Marked as answer by JohnG1000 Thursday, March 24, 2016 10:48 AM
    Wednesday, March 23, 2016 5:22 AM
    Moderator
  • I realize why the problem is occurring, I'm debugging right now, and will let you know if I get it fixed. Thanks.

    Thursday, March 24, 2016 3:30 AM
  • It's not quite fixed yet, but I am making progress. I should be able to fix it soon though. Thanks again.
    Thursday, March 24, 2016 10:50 AM