Skip to main content

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.

  1. 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"
          }
      }
      
  2. Run the application.

  3. Start Visual Studio and select Debug | Attach to Process in the toolbar.

    Attach to Process menu

  4. Select your running application in the invoked Attach to Process dialog.

    Attach To Process dialog

  5. 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.

    Set breakpoint

    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.

    File location folder tip

See Also