Security Error with Report Viewer Control and RDLC Reports in ASP.NET 4.0

dynamic-rdlc-generationrdlcreportviewer

Using ASP.NET 4.0, I'm creating an RDLC stream by instantiating a Microsoft.ReportingServices.RdlObjectModel.Report, setting the Code property, and returning the stream using the RdlSerializer.

Then I'm passing that stream to the ReportViewer like so:

ReportViewer1.LocalReport.LoadReportDefinition(rdlcStream);

If I don't set the Code property, I don't get any errors and the report displays properly, but when I set the Code property for a report that needs custom code, I get the below mentioned 'RequestMinimum' is obsolete error.

An unexpected error occurred while compiling expressions. Native compiler return value: ‘[BC40000] 'RequestMinimum' is obsolete: 'Assembly level declarative security is obsolete and is no longer enforced by the CLR by default. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.'.’.

This error doesn't occur using the Report Viewer control in a winforms app.

Has anyone seen/resolved this issue?

Best Answer

I do not know exactly the cause of this error, but in my experience, it was related with a simple copy and past from a expression from one cell to other cell inside the results table, all this after making changes in the layout and groups.

I recommend you delete any expression or formula, verify that your report is executed without any error message, and rewrite down all the expressions and formulas one to one, checking in every formula that your report open correctly.

That worked for me.

Related Topic