none
How to find Recursive erorr RRS feed

  • Question

  • I'm having troubles finding an error in my winforms app. A user is complaining that sometimes they get stuck in an "infinite error loop". That is, they get an error, and no matter what they do, they get get rid of the error box and fix the error.

    Now this is a winforms app. The way the validation is meant to work is like this:
    1) User enters field.
    2) User enters incorrect data (text into numeric field, negative value where not allowed, etc).
    3) User tries to exit field (tab or mouse)
    4) Message box appears, displaying an error.
    5) User closes the message box by either:
       a) Clicking on "OK"
       b) Clicking on the cross up the top right.
       c) Pressing escape.
    6) The conrol with the incorrect value is given focus again.
    7) User changes data, and tabs out. If the data is still incorrect, go back to step 4. Else, application accepts it.

    The user is swearing black and blue that sometimes they get stuck, where they are unable to fix the error, and if they do anything, they get the message box with the error in it again.

    While I am completely unable to reproduce it, at the moment I am treating this is a real problem. The user has no reason to lie, and I know I had problems like this during development.

    So, my question is, is there an easy way of finding where in the code this is possible? I realise it is very unlikely there is some sort of "find the stupid errors" button in visual studio, but I'm hoping there might be tools that can point me in the right direction.

    Few other details:
    Is a C# winforms database application (SQL Server)
    Using Visual Studio 2008.
    Using Infragistics controls.
    Using NetTiers framework.
    While the errors are usually thrown by nettiers or the controls themselves, the handling of them is done entirely by code written by myself.
    The code involved in this is spread out over a number of projects, and numerous classes.

    Thursday, July 21, 2011 3:11 AM

All replies

  • Hi

    It is difficult to guess what's going on unless you provide the code 

    especially validating and showing message box part.... 


    If this post answers your question, please click "Mark As Answer". If this post is helpful please click "Mark as Helpful".
    Thursday, July 21, 2011 6:03 AM
  • Hi

    It is difficult to guess what's going on unless you provide the code 

    especially validating and showing message box part.... 


    If this post answers your question, please click "Mark As Answer". If this post is helpful please click "Mark as Helpful".


    Kris,

    The offending code is not all in one neat place unfortunately. There are a number of classes involved (in different files), which are designed to be standard formatting/validating code for all grids (and other controls). This code handles it from start to end - when the user enters a control it makes a note of its original value, it captures escape press (to put back the original value), etc etc.

    Thursday, July 21, 2011 6:46 AM
  • Hi fweee,

    In the way you tell it these question mostly come because somebody has used this kind of code in his/her application.

    In VB

    Try
    'statements
    Catch
    End Try 

    In C#

    Try{//Statementds}Catch{}

    Often it winds up your executing in a recursive hard to find way.

    Check if that is done somewhere, because of the fact that these errors are hard to find and show up forever at the user side, is the reason I always advice not to do it like that.

    By the way, it are not really control problems, more for C#

    http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral


    Success
    Cor
    Thursday, July 21, 2011 8:05 AM
  • Hi

    You can put some break points in your code especially where you guess that the problem is raising and test the problem situation i think you can find the problem very soon. by the way there is no specific way to catch the errors and solve theme. 

    Thursday, July 21, 2011 8:17 AM
  • Hi fweee,

    In the way you tell it these question mostly come because somebody has used this kind of code in his/her application.

    In VB

    Try
    'statements
    Catch
    End Try 

    In C#

    Try{//Statementds}Catch{}

    Often it winds up your executing in a recursive hard to find way.

    Check if that is done somewhere, because of the fact that these errors are hard to find and show up forever at the user side, is the reason I always advice not to do it like that.

    By the way, it are not really control problems, more for C#

    http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral


    Success
    Cor

    Cor,

    Do you mean a try/catch statement where the catch doesnt actually do anything (so it suppresses the error). We do that sometimes.

    I wasnt sure which area this should go in. I thought seeing as though it is handling the errors at the GUI (winforms) level, it kind of fit into here.

    Thursday, July 21, 2011 10:20 AM
  • Hi

    You can put some break points in your code especially where you guess that the problem is raising and test the problem situation i think you can find the problem very soon. by the way there is no specific way to catch the errors and solve theme. 

    The problem is I am completely unable to reproduce the problem myself. I thought the chances were slim that what I wanted was possible.

    I already have some logging built into the app - I might just have to step this up to try to catch this error out.

    Either that, or completely re-write how validation works. Really dont want to do that.

    Thursday, July 21, 2011 10:23 AM
  • > 3)User tries to exit field (tab or mouse)
    > 4) Message box appears, displaying an error.
    > 6) The control with the incorrect value is given focus again

    I've always been wary about doing anything on focus changes - I know it's how a lot of applications work but I choose not to.

    For one thing, the idea of being "locked" into a particular field until I "get it right" annoys the h*** out of me and I'm sure it does a lot of other people as well. 

    By all means pop up an error message or whatever but 'tag' the field as invalid (so that they can't do anything "useful" until they've sorted it out) and let them move around the other fields.  It's possible that the problem is a dependency between two or more fields and you can't fix field 'B' if you're trapped in field 'A'. 

     


    Regards, Phill W.
    Thursday, July 21, 2011 11:52 AM
  • Wmmm, hard to troubleshoot.

    Hi fweeee,

    If it is possiblem you could log your action in one log file, such as the each step of your code. Or as Cor said, use Try...Catch to catch the exception.

    Because, no specific error, it is hard to guess the cause. And I can say, it you have a power exception manager class, or a log system in your application, it can tell when and where the code has problem. Just log the information or collect the exceptions from youe application, then ask your client to provide this information that can help you and us to troubleshoot.

     

    Usually, we will compare the system settings between the client machine which has error and the development machine. Does it have the translater tool or some antivirus tool. Could you please try to check if there are some other software change your application behaviour? Since some software may popup the message that may change the focus logic of your application.

    Sincerely,


    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    Monday, July 25, 2011 3:56 AM
    Moderator
  • Bob,

    I started this thread, hoping there might be some magic bullet or trick or something that would point me to my problem. There is much I dont know about visual studio, so maybe I missed a trick? But it is now becoming apparent that there are no tricks I have missed out on. All I have is the standard stuff.

    I'm goign to try adding more logging around this area, and maybe find it like that.

    The main difference between my environment and theirs, is some of their client computers are woefully underpowered. We are starting to suspect this could be a contributing factor. The user is typing away, the computer pauses for a few seconds, and the keystrokes buffer. When the computer "un-pauses", all the keystrokes get pushed to our app, causing an error, and every time the user clicks on "OK", more keystrokes come through, causing another error.

    We are guessing here at the moment.

    Thanks for the tips.

    Monday, July 25, 2011 10:53 AM
  • I belive you know the method to use VS to debug and know how to log the information you want to know. But same with the similar issue, the strange issue we usually ask for the more inforamtion, and it is better to reproduce the issue in our side.

    Thanks for the reply, for any specific issue, we first need to narrow the scope, to switch the features and test many cases, try to find which one can effect the issue. Then we could continue to do research.

    Based on your descriiption, the user's computer may have a device to occur the more keystrokes. Please try to change an new input device and test it again. And in general, we could use these tool to know what the process is doing:

    Process Monitor: http://technet.microsoft.com/en-us/sysinternals/bb896645

    Process Explorer: http://technet.microsoft.com/en-us/sysinternals/bb896653

     

    Sincerely,


    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, July 25, 2011 4:46 PM
    Moderator