This is a migrated thread and some comments may be shown as answers.

report blowing up

4 Answers 122 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Joe
Top achievements
Rank 1
Joe asked on 31 Jan 2013, 09:29 PM
Seeing this error. I fall back to an earlier version of my report which doesn't do this, make  a few changes, and I see this again. Any help would be appreciated.

An error has occurred while rendering the report: System.NullReferenceException: Object reference not set to an instance of an object.
   at Telerik.Reporting.Processing.Table.ForEachCell(Action`1 action)
   at Telerik.Reporting.Processing.Table.MeasureContent(IMeasureContext context, SizeRF availableClientSize)
   at Telerik.Reporting.Processing.VisualElement.MeasureOverride(IMeasureContext context, SizeRF availableSize)
   at Telerik.Reporting.Processing.ProcessingElement.MeasureOverride(IMeasureContext context, SizeRF availableSize)
   at Telerik.Reporting.Processing.AbsolutePositionLayout.MeasureChildItems(IMeasureContext context, SizeRF availableClientSize)
   at Telerik.Reporting.Processing.AbsolutePositionLayout.MeasureContent(IMeasureContext context, SizeRF availableClientSize)
   at Telerik.Reporting.Processing.ReportSectionBase.MeasureContent(IMeasureContext context, SizeRF availableClientSize)
   at Telerik.Reporting.Processing.VisualElement.MeasureOverride(IMeasureContext context, SizeRF availableSize)
   at Telerik.Reporting.Processing.ProcessingElement.MeasureOverride(IMeasureContext context, SizeRF availableSize)
   at Telerik.Reporting.Processing.StackLayout.MeasureContent(IMeasureContext context, SizeRF availableClientSize)
   at Telerik.Reporting.Processing.Group.MeasureContent(IMeasureContext context, SizeRF availableClientSize)
   at Telerik.Reporting.Processing.VisualElement.MeasureOverride(IMeasureContext context, SizeRF availableSize)
   at Telerik.Reporting.Processing.ProcessingElement.MeasureOverride(IMeasureContext context, SizeRF availableSize)
   at Telerik.Reporting.Processing.StackLayout.MeasureContent(IMeasureContext context, SizeRF availableClientSize)
   at Telerik.Reporting.Processing.Report.MeasureContent(IMeasureContext context, SizeRF availableClientSize)
   at Telerik.Reporting.Processing.VisualElement.MeasureOverride(IMeasureContext context, SizeRF availableSize)
   at Telerik.Reporting.Processing.ProcessingElement.MeasureOverride(IMeasureContext context, SizeRF availableSize)
   at Telerik.Reporting.Processing.LayoutElement.MeasureElement(LayoutElement elementToMeasure, IMeasureContext context)
   at Telerik.Reporting.XamlRendering.SilverlightReportInteractive.MeasureReportCore(Report report, IMeasureContext measureContext)
   at Telerik.Reporting.BaseRendering.RenderingExtensionBase.Render(Report report, Hashtable renderingContext, Hashtable deviceInfo, CreateStream createStreamCallback, EvaluateHeaderFooterExpressions evalHeaderFooterCallback)

4 Answers, 1 is accepted

Sort by
0
Hadib Ahmabi
Top achievements
Rank 1
answered on 01 Feb 2013, 01:11 PM
See if you by any chance have a Table/Crosstab that does not have item in a certain cell (empty cell) or have elements with width/height = 0
0
Joe
Top achievements
Rank 1
answered on 01 Feb 2013, 02:08 PM
Is there any way to determine what cell is causing the problem? Unfortunately the crosstab is fairly complicated.
0
Hadib Ahmabi
Top achievements
Rank 1
answered on 01 Feb 2013, 03:28 PM
First check the designer.cs for 0 value sizes.

I don't believe there is an easy way to check for missing cells.
You can serialize the report to XML. In the XML, it might be easier to see what's missing (and you can also share it).

This problem,however, should occur only when you are messing with the crosstab programmatically. You need to check that there is an item assigned for each of the cells (Row * Col) + for the headers of the groups, etc.. 

My advice - if you are not building the crosstab dynamically, start over again and use the designer only.
If you are building it dynamically - create a sample one with the designer and then compare it to yours and see what you might be missing. 
0
Steven
Top achievements
Rank 1
answered on 02 Feb 2013, 09:29 AM
You could create your own table cell iterator and apply a generic action on the cells within the table ItemDataBound event.

This way you can catch the error and easily get the Row and Column indexes.

I've received this error with a missing cell's ReportItem and when the the ReportItem was assigned directly to a Table.  
The fix for the second issue was to wrap the nested table into a Panel.


public static void ForEachCell(this Telerik.Reporting.Processing.Table table, Action<ITableCell> action)
{
    int count = table.Rows.Count;
    int num = table.Columns.Count;
    for (int i = 0; i < count; i++)
    {
        ITableCell tableCell = null;
        for (int j = 0; j < num; j = j + tableCell.ColumnSpan)
        {
            tableCell = table.GetCell(i, j);
            if (tableCell.RowIndex == i)
            {
                action(tableCell);
            }
        }
    }
}


Tags
General Discussions
Asked by
Joe
Top achievements
Rank 1
Answers by
Hadib Ahmabi
Top achievements
Rank 1
Joe
Top achievements
Rank 1
Steven
Top achievements
Rank 1
Share this question
or