title: Visual Studio Debugger is Stepping Over/Out of Loop
body: <p>I have the following code to clean up a set of directories on my server. I am trying to step through the code to verify that it works, but I am getting an odd behavior in the debugger. I place a breakpoint on the first line, and press F8 to step through. When it gets to the for loop, it hits the first if statement once, then jumps out of the loop. There are 4 items in the collection the for loop is iterating, and I would expect that I would be able to step through the loop and watch what it does for each item in the collection, but this is not the case. Any ideas?</p>
  
  <p>Here is the code block in question:</p>
  
  <pre><code>Dim Dirs As New Collection(Of DirectoryInfo)
  Dirs.Add(New DirectoryInfo(HttpContext.Current.Server.MapPath("../PDFS/Reports/")))
  Dirs.Add(New DirectoryInfo(HttpContext.Current.Server.MapPath("../PDFS/Statements/")))
  Dirs.Add(New DirectoryInfo(HttpContext.Current.Server.MapPath("../PDFS/HistoryStatements/")))
  Dirs.Add(New DirectoryInfo(HttpContext.Current.Server.MapPath("../PDFS/ReminderStatements/")))
  
      For Each di As DirectoryInfo In Dirs
          If di.Exists Then
  
              CleanDir(di, 60)
  
              'Remove all previews
              If Directory.Exists(di.FullName &amp; "Preview") Then
                  Dim dPreview As New DirectoryInfo(di.FullName &amp; "Preview")
                  CleanDir(dPreview, 1)
              End If
  
          End If
      Next
  </code></pre>