ExecuteReportInCurrentAppDomain Method
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

LocalReport.ExecuteReportInCurrentAppDomain Method 

Causes processing extensions and expressions in the report to be executed in the current AppDomain.

Namespace: Microsoft.Reporting.WinForms
Assembly: Microsoft.ReportViewer.WinForms (in microsoft.reportviewer.winforms.dll)

public void ExecuteReportInCurrentAppDomain (
	Evidence reportEvidence
public void ExecuteReportInCurrentAppDomain (
	Evidence reportEvidence
public function ExecuteReportInCurrentAppDomain (
	reportEvidence : Evidence



An Evidence object that contains security information about the report.

Expressions in the report will be run in the current AppDomain with only the Execution security permission flag. By default, custom assemblies are not allowed in this mode. This is the default mode and is the mode to use for trusted reports.

This mode may also be used to run untrusted reports that do use trusted processing extensions.

To allow trusted processing extensions, the application must call AddTrustedCodeModuleInCurrentAppDomain.

In this example, a custom assembly containing a simple utility function that reads some data from a text file is used as an expression in a report.

using System.IO;
using System.Reflection;

public class Util
    public static string GetData()
        StreamReader sr = new StreamReader("data.txt");
        string data = sr.ReadToEnd();
        return data;

The following code is used to allow the report with the custom assembly to run in the current AppDomain.

reportViewer.LocalReport.ReportPath = "Report1.rdlc";
      Version=, Culture=neutral, PublicKeyToken=89012dab8080cc90");
© 2016 Microsoft