locked
Why WinForm C# applications hangs? RRS feed

  • Question

  • Hi,

    I wuld like to know why my WinForm C# application hangs after several times / minutes of usage. I checked all the sqlconnection and ensured it's all within try-catch and it's getting finally closed but still don't know why I am still have this problem?

    Is there any way to know the reason from windows log?

    Thanks,

    Jassim

    Monday, April 20, 2015 1:57 PM

Answers

  • Hi Jassim,

    >> I am not getting this error even when  I deploy it on my PC so I want to troubleshoot it on the user machine. Is this possible?

    Do you mean you cannot access the user machine?

    If so, I would suggest that you need to start the Visual Studio Remote Debugging Monitor on the user machine that reproduced the hang issue with the process you want to debug.

    Since it works well in your developing machine, Try to compare the difference with user machine. Maybe it related to OS environment or some registry was changed.  

    For more detailed information, please refer to this blog.

    How to debug crashes and hangs

    Note the "Remote Debugging"and "Call stack" sections.

    Best regards,

    kristin


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    • Edited by Kristin Xie Tuesday, April 21, 2015 9:01 AM
    • Marked as answer by Fred Bao Monday, May 11, 2015 11:13 AM
    Tuesday, April 21, 2015 9:00 AM

All replies

  • There is no way to answer this generically without knowing more about what your program does. But you will really need to narrow it down first.

    First, learn how to add debug points around where your program is hanging, run your application in debug mode and step through the lines.

    Second, you can add debug and trace lines to your application. See here for some tips.

    Hopefully this will enable you to narrow the problem down to a specific part of your code. Then, if you're still not sure why that bit of code is hanging, post it here for more advice!
    • Edited by RJP1973 Monday, April 20, 2015 3:04 PM
    Monday, April 20, 2015 3:03 PM
  • but the application is not hanging on visual studio.

    It's hanging when it's an EXE and being deployed

    Monday, April 20, 2015 3:28 PM
  • Are you saying that if you run it from Visual Studio you do NOT get the problem?

    If so, then I refer you to my previous suggestion of adding debug/trace lines to your application so that you can narrow down where the issue is occurring.

    Monday, April 20, 2015 4:11 PM
  • do you mean this will work once I deploy the application on the user machine? I am not getting this error even when  I deploy it on my PC so I want to troubleshoot it on the user machine. Is this possible?
    Monday, April 20, 2015 6:44 PM
  • Hi Jassim,

    >> I am not getting this error even when  I deploy it on my PC so I want to troubleshoot it on the user machine. Is this possible?

    Do you mean you cannot access the user machine?

    If so, I would suggest that you need to start the Visual Studio Remote Debugging Monitor on the user machine that reproduced the hang issue with the process you want to debug.

    Since it works well in your developing machine, Try to compare the difference with user machine. Maybe it related to OS environment or some registry was changed.  

    For more detailed information, please refer to this blog.

    How to debug crashes and hangs

    Note the "Remote Debugging"and "Call stack" sections.

    Best regards,

    kristin


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    • Edited by Kristin Xie Tuesday, April 21, 2015 9:01 AM
    • Marked as answer by Fred Bao Monday, May 11, 2015 11:13 AM
    Tuesday, April 21, 2015 9:00 AM