Results 1 to 3 of 3

Thread: How to prevent Just In Time Debugging (jit)

  1. #1

    Thread Starter
    Hyperactive Member Joye's Avatar
    Join Date
    Jul 2009
    Posts
    256

    How to prevent Just In Time Debugging (jit)

    Sometimes When I go testing my program on other PC's I get the just-in-time (JIT) debugging problem, probably with PC's that has Visual Studio Installed.

    Is there any way I can prevent or handle this error message from code or sittings in Visual Studio?

    This message comes after a Late bounded line of code.
    Also what is the best way to handle Late Bounded codes?

    I'm thinking to use:

    Code:
    Try
    Catch ex As Exception
    End Try

  2. #2
    You don't want to know.
    Join Date
    Aug 2010
    Posts
    4,578

    Re: How to prevent Just In Time Debugging (jit)

    The best way to prevent it is to properly test your code so it doesn't throw unhandled exceptions.

    That window shows up only on machines that have VS installed and is your chance to debug the program so you find out what's wrong and fix it. On machines that don't have VS installed, the application will crash and you won't get much information. Plus also your user will be mad, especially if they paid you for software that crashes.

    "Doing the right thing" is more complicated than just haphazardly tossing Try..Catch statements around. The way to go about it is, for every method you write, go over it line by line and logical grouping by logical grouping, and think:

    Does this line represent a risk of throwing an exception? If so, should I catch it? If I do, can I do something to fix it, or should I log that error and move on? If I don't fix it, what happens? How does the code that called it handle that? If I can't deal with those consequences, is there a safe way I can shut the program down and tell the user what happened?
    That's a lot of work and it's much harder to do after you finish. It's better to do this while you're writing code, because that's when you have the most leeway for making architectural changes if you don't like how it's going.
    This answer is wrong. You should be using TableAdapter and Dictionaries instead.

  3. #3
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    107,159

    Re: How to prevent Just In Time Debugging (jit)

    Assuming a WinForms app, you should be handling the UnhandledException event of the application. You would still add appropriate handling for specific exceptions that could reasonably be thrown but for anything that does slip through, you can log it and exit gracefully instead of crashing, which means no offers to debug on machines that support it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width