Dieser Inhalt liegt nicht in Ihrer bevorzugten Sprache vor.

Der Inhalt wird Ihnen in einer anderen verfügbaren Sprache angezeigt. Ihr Browser bietet ggf. Funktionen, die Sie bei der Übersetzung des Textes unterstützen.

Debugging DIAdem User Dialogs (SUD) and DataPlugins

Updated Mar 26, 2024

Environment

Software

  • DIAdem

Other

  • Microsoft Visual Studio

The integrated debugger in DIAdem SCRIPT does not support user dialog boxes, also known as scriptable user dialogs (SUD) and DataPlugins debugging. This article describes how you can accomplish this using an external debugger, such as Microsoft Visual Studio. The debugger stays connected to DIAdem and interrupts the execution of the script when there is an error or encounters a stop statement.

The steps are slightly different if you are using DIAdem 2018 and older, or DIAdem 2019 and newer, therefore, refer to the appropriate section based on the DIAdem version being used.

Before you begin, you must have Microsoft Visual Studio with the Just-In-Time debugger support:
  1. Download the Visual Studio Community installer or another version of Visual Studio from the Internet, run the installer, and follow the instructions in the installer.
  2. During installation, the installer prompts you to customize your user experience. Select the Individual components tab and enable the following components:
  • JavaScript and TypeScript language support
  • Just-In-Time debugger

DIAdem 2019 and newer

1. Click the Use External Debugger button in the SCRIPT panel toolbar.
scripttoolbar.png

2. To add a breakpoint in the SUD or DataPlugin code, you can add a stop statement.

stop.JPG

3. Click Run Script + F5 in the DIAdem SCRIPT toolbar to run the script that is calling the SUD or DataPlugin.
4. As soon as the script executes the stop command, the Choose Just-In-Time Debugger dialog box opens, displaying the list of available debuggers. Select the Visual Studio version you have installed and click OK.

jitdebugger.JPG

5. Visual Studio opens in debug mode. You can set breakpoints, process the script step-by-step, and use other debugging functions.
6. In Visual Studio click Stop Debugging (Shift + F5) after debugging to disconnect the debugger from the DIAdem  environment.
 
If you do not want to select the debugger from the dialog box, you can attach the debugger to the DIAdem process before executing the script in DIAdem:
  1. In Microsoft Visual Studio, go to Debug>>Attach to Process...
  2. Attach the debugger to the DIAdem process
  3. Run the script in DIAdem. 
To stop using an external debugger and enable the internal debugger option again, you can click the Use External Debugger again.
 

DIAdem 2018 and older

Since the Use External Debugger option on the toolbar of DIAdem SCRIPT was added in DIAdem 2019, you will need to manually toggle the value of a Windows Registry key to be able to debug using an external debugger.

1. Open the Windows Registry.

WARNING: Inappropriate changes to the Windows Registry can cause unexpected behavior in the Operating System. To safeguard against such an event, you can backup your existing Registry by selecting File>>Export after launching the Registry Editor and before making any changes.

2. Edit the JITDebug key at HKEY_CURRENT_USER\Software\Microsoft\Windows Script\Settings, so that it has a 1 as its value:

jitkey.png

3. Follow the steps in the DIAdem 2019 and newer section of this article starting with step 2.

To stop using an external debugger and enable the internal debugger option again, you will need to edit the JITDebug key back to a value of 0.