User Guide Cancel

Debug applications

Debugging lets you examine and troubleshoot your application. When you debug, you can control when the application must stop at specific points in the code. You can also monitor important variables and test your code. Debugging uses a configuration to control how applications are launched. When you debug your application, you run the debug version of the application file. 

ColdFusion Builder extension for Visual Studio Code offers a powerful new developer tool in its debugger, an interactive step debugger that allows CFML developers to walk through the execution of their code, observing what lines of code it executes, what other CFML files (include files, custom tags, or CFCs) it executes, the value of all variables (optionally in all scopes) at a given point during execution, and much more. 

Debugging lets you examine and troubleshoot your application. When you debug, you can control when the application must stop at specific points in the code. You can also monitor important variables and test your code. Debugging uses a configuration to control how applications are launched. When you debug your application, you run the debug version of the application file. 

You can even change the value of variables on the fly within the debugger, such as to alter the runtime flow of execution of your code. 

Pre-requisites 

On the ColdFusion Administrator, enable the following: 

RDS

After making the changes, restart ColdFusion.

Enable Request Debugging Output

Allow Line Debugging 

Set and remove breakpoints

You use breakpoints to control the running of your application so you can inspect your code and debug your application. You add breakpoints in the code editor and then manage them in the Breakpoints view. You can also set breakpoints as you write code or while you debug.

Set a Breakpoint

  1. In the editor, locate the line of code where you want to set a breakpoint, and click in the marker bar along the left-edge of the editor.
  2. Set the breakpoints in your CFML file to stop executing the page at points. When you set a breakpoint on a line, the CFML stops executing just before that line. For example, if you set a breakpoint on the third line in the following CFML page, execution stops before that line.

Remove a breakpoint

In the marker bar along the left-edge of the editor, click an existing breakpoint. 

The breakpoint is removed from the marker bar and the Breakpoints view of the extension. 

To remove all the breakpoints in the file, select Run > Remove all Breakpoints from the main toolbar menu.

Disable a breakpoint

To disable all the breakpoints in the file, select Run > Disable all Breakpoints from the main toolbar menu.

Run code line by line

  1. Insert some breakpoints in the code.
  2. In the editor, click Run or Debug and then click Debug File.

The Step menu appears

You can use the Step Into, Step Over, and Step Return buttons to proceed through your CFML code line by line.

STEP INTO

Use Step Into for UDFs, CFCs, custom tags, and included files. Avoid using Step Into on CFML tags such as the cfset tag. Step Into is more performance intensive than Step Over. When stepping into functions, tags, and files, the file must be displayed in one of the open projects. The file that you are stepping in must be in an open project. 

STEP OVER

Use Step Over to proceed through your CFML application, bypassing included files, such as UDFs or CFCs. 

STEP RETURN

Use Step Return to return to the original page from which you entered the included file, such as UDFs or CFCs.

Inspect Variables

As you run CFML code, you can see the values and scope of variables in the Variables view.

Watch expressions

Watch expressions are useful to watch critical variables that sometimes go out of scope when you step into a different function. You can create your own expressions to watch and evaluate. You can modify the expressions during the debugging session.

 

You can do the following in the Expressions view:  

  • Create a watch expression by right-clicking and selecting Add Watch Expression. You can then enter the expression in the Add Watch Expression dialog box.

  • Ignore a watch expression that you’ve added by right-clicking the expression and selecting Disable.

  • Edit a watch expression by right-clicking the expression and selecting Edit Watch Expression. You can then modify the expression.

Run and debug in VS Code 

If you have not configured running and debugging, then VS Code displays the Run start view. 
 

Run and Debug is a custom debug option provided by VS Code. If you click Create a JSON launch file and follow the prompts, you can associate your file with "CFML Debug" profile and then use it to run the debugger. 



CFML debug has overridden VS Code’s default debug and run commands. So, debugger can be started without creating json file.

Video

Watch this video and learn debugging using the plugin.

 Adobe

Get help faster and easier

New user?