Debug Scripts in Visual Studio

This topic describes how to validate all report scripts at one time using the Visual Studio debugger. This feature is not available in Visual Studio Express editions, because they do not provide the “Attach to Process” option.

Important

Report scripts can never be considered entirely safe, and their execution cannot be completely restricted.

In particular, assigning security permissions to report scripts does not restrict them from accessing the .NET framework's static variables and methods.

Consider using binding expressions as the most convenient approach to performing custom calculations over your report's data.

To debug scripts using Visual Studio, do the following.

  1. Add the following lines enclosed in the <system.diagnostics> tags to the <configuration> section of the config file of your application (or the Web.config file of your ASP.NET application).

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <system.diagnostics>
        <switches>
          <add name="AllowDebugXtraReportScripts" value="BreakWhenDebuggerAttached"/>
        </switches>
      </system.diagnostics>
    </configuration>
    
  2. Next, run your application and attach Visual Studio to this process.

    scripting-attach-to-process-menu

    scripting-attach-to-process-dialog

  3. It is possible to set a breakpoint in the script code after it becomes available at Visual Studio runtime, each time the XtraReport.CreateDocument method is called (e.g., when switching to the Preview tab in an End-User Designer).

    scripting-setting-breakpoint-runtime

The temporary files that were created during script debugging are located in the following directory: C:\Users\User_Name\AppData\Local\Temp.

scripting-removing-temporary-files

See Also