(rsRuntimeErrorInExpression) assembly does not allow partially trusted callers

 

I came across the above stated error while the report being rendered in Windows forms application with the results printed as “#Error”. The data source used is Object data source whose assembly is different than the report’s (rdlc) assembly.

The error output from the debug window is shown below.

1_Mod

 

The following points worth mentioning for this cause:

  • The Object’s used to design the report (data source) is in a different assembly than the report’s (rdlc) assembly.
  • parameters are used to print custom information in the report
  • Custom code (proprietary vs.net report specific code hosted in the report itself which can be found in the report properties->code tab) was used in the report to overcome null values
  • In the Security’s tab under the main winform’s start up project’s properties’ following are checked (refer the diagram)
    • Enable the ClickOnce Security Settings
    • This is a full trust application

2

From the error message it is clear that the issue is due to security but how to overcome? can we change the security settings as “This is a partial trust application” instead full trust?. We can but in our case I can’t change which will impact globally.

What we did was, we added the following code to allow partially trusted callers in the AssemblyInfo.vb for the project where our domain objects (Object data source) reside

4

In our reports, we used custom codes, expressions etc which needs to be compiled and executed at runtime through .Net reflection. Under Full trust, reflection will not work. Hope this helps!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s