Reportviewer 2010 SP1 and problems referencing nested objects RRS feed

  • Question

  • Back when the nested object bug surfaced in the 2010 update of Reportviewer, I opted for the object flattening work-around in order to use the Reportviewer in my Windows Forms Application.  Since it has been reported that the release of VS2010 SP1 and Reportviewer 2010 SP1 fixed the nested object problem, I thought it might be time to re-engineer my code and hopefully get rid of all the flattened objects I created to render reports.

    Unfortunately, after updating Visual Studio 2010 and Report Viewer 2010 to SP1, I am still getting "#Error" when I attempt to render child values.  Can anyone give me some direction for resolving this issue?  I see where some people are able to get this working with their classes and I would like to do the same do the same with my code, but I'm not sure if the problems are in my object classes, the Linq to SQL query result I'm trying to render, or the nested object problem persisting in Visual Studio and the Reportviewer itself.  Here is a summary of my situation and what I have tried:

    • Environment: Windows 7 / VS2010 SP1 / VB Windows Forms Application targeting .net 4.0
    • Reportviewer: 2010 SP1 operating in Local mode (RDLC)
    • Dataset:  Linq to SQL custom object SaleComp (90 POCO properties + 1 associated object PropImage (1:1 association); DBML generated with sqlmetal.exe
    • Problem:  Reportviewer is treating the Dataset as a flat table rather than a hierarchical object: 1st order properties render with correct values (value=fields!fieldname.value); 2nd order properties render as "#Error" (value=fields!parent.value.childFieldName)
    • Dataset:  DataSource is a strongly-typed list of custom object type. It is serializable and viewable in the debugger before passing to reportviewer instance.
    • Serialization: The SaleComp and PropImage objects are serializable with both Binary and DataContract serializers in my project. The following serialization test works OK before refreshing the reportviewer:
    •         Dim x As New System.Web.Script.Serialization.JavaScriptSerializer
              Dim y As String = x.Serialize(salecompBindingSource.DataSource)
    • AppDomain:  I think permission is OK (all data passed directly from the app to the reportviewer) but test as follows:
    •       Dim sec As New System.Security.PermissionSetSystem.Security.Permissions.PermissionState.Unrestricted)
    •       ReportViewer1.LocalReport.SetBasePermissionsForSandboxAppDomain(sec)
    • Reportviewer: I downloaded Reportviewer 2012 Beta, and it requires but does not recognize installation of SQL 2012 CLR Types.
    • Rumors:  One posting reports that strongly-named assemblies always render #Error for nested objects (Is this true?)
    • reports that fields!parent.value.child does not work in VS2010

    If anyone has any suggestions for me, I would appreciate the guidance.

    Thanks, -BGood


    Friday, March 23, 2012 7:26 PM

All replies

  • Try taking a look at Brian Hartman's blog there is a new requirement that your objects have to be marked Serializable for Nested Objects to work:

    Also for the ReportViewer 2012 Runtime there was an issue where the RCO SQL CLR Types link was broken but should be fixed now, look for the SQL CLR download link on the following page:

    Hope this helps!

    Matt M.
    This posting is provided "AS IS" with no warranties, and confers no rights

    Friday, March 23, 2012 10:01 PM
  • Thanks for the suggestions, Matt.  My objects appear to be serializable (both binary and json), but I can't see what is happening internal to the reportviewer.  When I tried to install reportviewer 2012 beta, I had to install the SQL CLR types first, but the 2012 reportviewer doesn't recognize them as being installed.  ... Thanks, but still stuck ...


    Saturday, March 24, 2012 2:47 AM
  • PS: In response to some reports that definitions for datasets and business objects needed to be in the root of the project folder, I moved the Business Object (*.dbml) and Dataset (*.xsd) definitions from the /Data/ subdirectory to the root project directory and rebuilt my project.  This had no effect on the reportviewer printing "#Error" instead of a value for nested object properties.  -BGood


    Saturday, March 24, 2012 8:25 PM
  • Hi BGood,

    Were you able to solve the problem?

    Friday, July 5, 2013 5:23 PM
  • Thanks for checking in, but unfortunately, no. 

    I wasted an unbelievable amount of time trying to reference child objects with the Parent.Child.Child syntax.   The suggested work-around or flattening the object graph with a shim class did work for me, but requires that I maintain shim objects solely to accommodate the finicky reportviewer.


    Friday, July 5, 2013 6:43 PM