Executing lines twice !!!
Hello techs,
I have problem in one of my test project... i am developing a client server project in C# using telnet server.
In some parts of code ... the lines are working twice ....
suppose :
string sRecieved = Encoding.ASCII.GetString( m_byBuff, 0, nBytesRec );
using F11 to debug the issue ... the above line will get the execution control and after execution, normally it need to go to next line for execution, but here by pressing F11, the same line will get the control and executes once more ... ????
I am not using any thread or timers .... I am using sockets for doing this ...
if any clarifications needed, please ask ...
thankzzzz
Re: Executing lines twice !!!
F11 is for stepping into a method. If there's no method to step into then it should step to the next line, so what you're saying does seem strange, but if there's no method to step into then why use F11 at all? F10 specifically steps to the next line, so try using it and see if that line still gets executed twice.
Re: Executing lines twice !!!
Also, if this code is in an event handler, make sure you haven't assigned the event twice. I have seen this happen when you manually add the event in code (obj.Event += MyHandler(...)) and when the event handler has the handles keyword after its definition (void MyHandler(...) Handles obj.Event).