I am running this code in my thread created using new Thread() . Once obj is located, the thread dies. However, thread execution should never stop due to an infinite loop:
while (true) { using (var obj = httpWebResponse.GetResponseStream()) {
Why is this happening? This is not the case if I call obj.Dispose() explicitly. Without recycling, the stream works fine and continues indefinitely.
Is the CLR counting the number of references to objects contained in the code and killing the stream when they reach zero, despite the loop?
source share