Search code examples
c#.net-corereportexpressionrdlc

RDLC Column visibility expression throws error: Native compiler return value: is not accessible in this context because it is 'Friend'


I want to Show or Hide some columns of a table in my RDLC report on runtime. I am sending the list of columns that I want to display in a separate DataSource (which only contains column names).

I have added following formula in the Columns Visibility Expression (intention is to show STATUS column only if dataset contains a record with STATUS entry).

=iif(instr(Fields!myData.Value,"Status") > 0, false, true)

When I run the report, I get below error message. But if I put this expression in any column of the table to see the result, then it works fine.

An error occurred during local report processing.;The definition of the report '......\\netcoreapp3.1\\Reports/FlightScheduleArrival.rdlc' is invalid.\r\nAn unexpected error occurred while compiling expressions. Native compiler return value: ‘[BC30390] 'AspNetCore.ReportingServices.RdlExpressions.ExpressionHostObjectModel.DataRegionExprHost(Of TMemberType, TCellType).m_memberTreeHostsRemotable' is not accessible in this context because it is 'Friend'.’."


Solution

  • Sounds like the library 'AspNetCore.ReportingServices' try to access m_memberTreeHostsRemotable in 'AspNetCore.ReportingServices.RdlExpressions.ExpressionHostObjectModel.DataRegionExprHost'.

    An attribute need to be added in 'DataRegionExprHost' to allow access, which the creator likely forgot.

    This is a third party RDLC reporting library for .NET Core. The source code for 'ReportingServices' is not published so we can't fix it ourselves.

    Since 'ReportingServices' was made by same developer. You will need to a write bug report in github page hoping for fixes.