Let's follow the simple logic. 1) in your code sample, you show exactly one loop; 2) you maintain that it should be executed once while you observe that it happens twice; let's assume this is a correct observation.
I also thin that we can assume that you are not making something silly, such as explicitly nesting the loop you show in some other loop and failing to tell us about it. See also:
Occam's razor — Wikipedia, the free encyclopedia[
^],
http://lurkmore.so/images/1/1b/Occam_razor.jpg[
^]. :-)
Then, we can make a logical conclusion: the only reasonable explanation is that your problem lie outside of this code, which is executed via some call to some method containing your code sample. Note that showing just the code fragment is not always enough; your case is the case when you had to show the whole method (maybe incomplete) and sometimes its declaring type. There is some call from outside code you expected and some you did not expect, mistakenly. You need to find out all cases when the method is called.
Now, the remaining problem is to detect it. I can give you a simple and universal advice on how to do it quickly. Obviously, use the debugger, but how to make it quick? First put a break point on the beginning of your loop in question, and also, optionally, on the first statement of your method. Then execute the code under the debugger. When debugging stops at the break point for the first line, do the following:
show the debug window called "Call Stack".
This window is the key: you can walk the stack and track where the call comes from, both at first run and all following cases. That's all. This is really easy.
—SA