Reputation: 7337
if I put a debuger from starting line one of this code and step through i dont get anything event after the line
xmlData = reader.ReadToEnd();
but if I have debugger on the last line of this code.. where the brace closes, I get everything. i dont know if this only the debuger acting crazy, or a real thing
using (StreamReader reader = new StreamReader(context.Request.InputStream))
{
xmlData = reader.ReadToEnd();
}
Can anyone tell me whats going on. cause sometimes i am not able to get any data from streamreader, even though the data is sent correctly.
Thanks
Upvotes: 1
Views: 224
Reputation: 838086
If you put a breakpoint on a line the break occurs before that line gets executed, so it's no surprise that you don't get any data.
But I suspect what you mean is that you place a breakpoint and then step through the code slowly until you reach the end and then check the contents of the variable and find that they are empty.
Upvotes: 1
Reputation: 88044
The reader isn't going to perform the actual "read" until the ReadToEnd method is called. What are you trying to do?
Upvotes: 5