Debug Scripts in Visual Studio
This topic describes how to debug scripts used within the End-User Report Designer.
Important
Report scripts are not secure. We recommend that you use expression bindings instead.
Open your application that contains the End-User Report Designer. Do one of the following depending on the application target framework:
.NET Framework – add the <system.diagnostics> section to the application’s configuration file as shown below:
<?xml version="1.0" encoding="utf-8"?> <configuration> ... <system.diagnostics> <switches> <add name="AllowDebugXtraReportScripts" value="BreakWhenDebuggerAttached"/> </switches> </system.diagnostics> </configuration>
.NET 6+ – create a
runtimeConfig.template.json
file in the application’s folder and put the following settings into this file:{ "configProperties": { "AllowDebugXtraReportScripts": "BreakWhenDebuggerAttached" } }
Run the application.
Start Visual Studio and select Debug | Attach to Process in the toolbar.
Select your running application in the invoked Attach to Process dialog.
Return to the application with the End-User Report Designer and switch to the Preview tab. This operation opens a temporary generated class with all report elements and script code in Visual Studio.
You can debug the script code in this tab (for example, use breakpoints). To see a file location folder, place a cursor over this file.