none
How to handle Visual studio code executes twice after deployment (run time )

    Question

  • Hi All,



    My Visual studio code giving results twice. I think it is executing twice after deployment.

    When I tried to dedug the code the same line of code is running twice . The message shows "The process or thread has changed since the last step" 

    I figured out the issue, the thread is running multiple times. If I freeze one of the same thread it gives me 1 result.(which is correct). However, this is done while debugging the code. 

    How to handle the same after deployment of code(run time).

    Can anyone please help me out.

    Thursday, April 6, 2017 3:22 PM

All replies



  • I figured out the issue, the thread is running multiple times. If I freeze one of the same thread it gives me 1 result.(which is correct). However, this is done while debugging the code. 


    Then your program is buggy. You need to fix it, not deploy it.
    Thursday, April 6, 2017 3:26 PM


  • I figured out the issue, the thread is running multiple times. If I freeze one of the same thread it gives me 1 result.(which is correct). However, this is done while debugging the code. 


    Then your program is buggy. You need to fix it, not deploy it.

    The issue is not always. 


    Thursday, April 6, 2017 4:00 PM
  • The issue is not always. 

    That doesn't change the fact that your program must be harbouring a bug. It just means the bug will be harder to find. You already know that the thread may be running more times than intended. You need to find out why.

    • Edited by Brian Muth Thursday, April 6, 2017 9:49 PM spelling
    Thursday, April 6, 2017 7:37 PM
  • Hi Sri2108,

    I agree with Brian Muth, first, you need to check you code to find the reason. For example, when we develop a Web form and placed the initialization code in the Page_Load() method of the form, then attached this method to the Load event of web form, in this case, the Page_Load() method will be excuting twice in stead of once.

    Besides, if you use avast, try to disable Avast DeepScreen, then check if it works fine. (go into settings -> antivirus -> un-check DeepScreen).

    Hope this can help you.


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, April 7, 2017 7:19 AM