2

I have a console application that runs every 5 minutes in Windows Task Scheduler. The program doesn't run again if the program is still running after 5 minutes, so only one instance at a time.

However, when an exception occurs, the just in time debugger appears and doesn't go away, preventing the application from running again.

Is there a way to prevent this? I want the JIT debugger to not appear so the application is finished and it will run again on the next try.

TylerH
  • 20,799
  • 66
  • 75
  • 101
Mike Flynn
  • 22,342
  • 54
  • 182
  • 341
  • This is only a "problem" on your machine, it has a JIT-debugger registered. A goody that came along for the ride when you installed VS on that machine. With the explicit intention to help you fix your program. Not an issue on a production machine. – Hans Passant Apr 07 '19 at 01:29

1 Answers1

0

One question would be why the program is ending with an exception? Wouldn't it be better to have some redirection into file if you don't need the exception(s).

I would personally disable JIT debugger at registry. From the visual studio docs, when VS is not installed at the computer, which is probably the case.

Disable Just-In-Time debugging from the Windows registry

Just-In-Time debugging may still be enabled even if Visual Studio is no longer installed on your computer. If Visual Studio is no longer installed, you can disable Just-In-Time debugging by editing the Windows registry.

To disable Just-In-Time debugging by editing the registry:

  1. From the Windows Start menu, run the Registry Editor (regedit.exe).

  2. In the Registry Editor window, locate and delete the following registry entries:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\DbgManagedDebugger
    
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug\Debugger
    
  3. If your computer is running a 64-bit operating system, also delete the following registry entries:

    HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\DbgManagedDebugger
    
    HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\AeDebug\Debugger
    

Make sure not to delete or change any other registry keys.

tukan
  • 17,050
  • 1
  • 20
  • 48