NullReferenceException after upgrading from old 2016 version on VS 2013 to latest on VS 2022

1 Answer 100 Views
DataSources Report Viewer - ASP.NET Upgrade
Oliver
Top achievements
Rank 1
Oliver asked on 30 Nov 2022, 09:35 AM

Hello Telerik Team,

we're currently upgrading our Code from Visual Studio 2013 with a Telerik Reporting Version from around 2016 running on Windows 8. With all the latest versions, meaning VS 2022, Windows 10 and Reporting Version 16.2.22.1109 we get the error shown below.

We're not sure how we can narrow this down since there is no hint which value is NULL here. The old version is running in production with the same data and works fine.

How can we approach this issue and narrow it down? Do you need any additional information?

Thanks in adavance!


[NullReferenceException: Object reference not set to an instance of an object.]
   Telerik.Reporting.Processing.Table.ForEachCell(Action`1 action) +121
   Telerik.Reporting.Processing.Table.MeasureDataItemContent(IMeasureContext context, SizeLU availableClientSize) +622
   Telerik.Reporting.Processing.DataItem.MeasureContent(IMeasureContext context, SizeLU availableClientSize) +86
   Telerik.Reporting.Processing.LayoutElement.MeasureCore(IMeasureContext context, SizeLU availableSize) +97
   Telerik.Reporting.Processing.VisualElement.MeasureCore(IMeasureContext context, SizeLU availableSize) +104
   Telerik.Reporting.Processing.ProcessingElement.MeasureCore(IMeasureContext context, SizeLU availableSize) +47
   Telerik.Reporting.Processing.AbsolutePositionLayout.MeasureChildItems(IMeasureContext context, SizeLU availableClientSize) +235
   Telerik.Reporting.Processing.AbsolutePositionLayout.MeasureContent(IMeasureContext context, SizeLU availableClientSize) +50
   Telerik.Reporting.Processing.ReportSectionBase.MeasureContent(IMeasureContext context, SizeLU availableClientSize) +117
   Telerik.Reporting.Processing.LayoutElement.MeasureCore(IMeasureContext context, SizeLU availableSize) +97
   Telerik.Reporting.Processing.VisualElement.MeasureCore(IMeasureContext context, SizeLU availableSize) +104
   Telerik.Reporting.Processing.ProcessingElement.MeasureCore(IMeasureContext context, SizeLU availableSize) +47
   Telerik.Reporting.Processing.StackLayout.MeasureContent(IMeasureContext context, SizeLU availableClientSize) +218
   Telerik.Reporting.Processing.Group.MeasureContent(IMeasureContext context, SizeLU availableClientSize) +101
   Telerik.Reporting.Processing.LayoutElement.MeasureCore(IMeasureContext context, SizeLU availableSize) +97
   Telerik.Reporting.Processing.VisualElement.MeasureCore(IMeasureContext context, SizeLU availableSize) +104
   Telerik.Reporting.Processing.ProcessingElement.MeasureCore(IMeasureContext context, SizeLU availableSize) +47
   Telerik.Reporting.Processing.StackLayout.MeasureContent(IMeasureContext context, SizeLU availableClientSize) +218
   Telerik.Reporting.Processing.Report.MeasureContent(IMeasureContext context, SizeLU availableClientSize) +246
   Telerik.Reporting.Processing.LayoutElement.MeasureCore(IMeasureContext context, SizeLU availableSize) +97
   Telerik.Reporting.Processing.VisualElement.MeasureCore(IMeasureContext context, SizeLU availableSize) +104
   Telerik.Reporting.Processing.ProcessingElement.MeasureCore(IMeasureContext context, SizeLU availableSize) +47
   Telerik.Reporting.Processing.LayoutElement.Measure(IMeasureContext context, SizeLU availableSize) +66
   Telerik.Reporting.Processing.LayoutElement.MeasureElement(LayoutElement elementToMeasure, SizeLU availableSize, IMeasureContext context) +30
   Telerik.Reporting.Html5Rendering.Html5ReportInteractive.MeasureRootCore(LayoutElement root, PageSettings pageSettings) +98
   Telerik.Reporting.BaseRendering.RenderingExtensionBase.Render(LayoutElement root, Hashtable renderingContext, Hashtable deviceInfo, CreateStream createStreamCallback, EvaluateHeaderFooterExpressions evalHeaderFooterCallback, PageSettings pageSettings) +893
   Telerik.Reporting.BaseRendering.RenderingExtensionBase.Render(Report report, Hashtable renderingContext, Hashtable deviceInfo, CreateStream createStreamCallback, EvaluateHeaderFooterExpressions evalHeaderFooterCallback) +78
   Telerik.Reporting.Processing.ReportProcessor.CountPages(IList`1 reports, IRenderingContext renderingContext, Hashtable deviceInfo, ExtensionInfo extensionInfo) +915
   Telerik.Reporting.Processing.ReportProcessor.RenderCore(ExtensionInfo extensionInfo, IList`1 processingReports, Hashtable deviceInfo, IRenderingContext renderingContext, CreateStream createStreamCallback) +875
   Telerik.ReportViewer.WebForms.ReportPageOperation.RenderReport(String format, IList`1 processingReports, Hashtable deviceInfo, IRenderingContext renderingContext) +122
   Telerik.ReportViewer.WebForms.ReportRenderOperation.PerformOperationOverride() +372
   Telerik.ReportViewer.WebForms.BasicHandler.ProcessRequest(HttpContext context) +248
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +542
   System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +75
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +93

1 Answer, 1 is accepted

Sort by
0
Todor
Telerik team
answered on 05 Dec 2022, 08:46 AM

Hello Oliver,

From the error message, I see that the legacy Web Forms Viewer throws when processing a table. Here is the code that throws:

void ForEachCell(Action<ITableCell> action)
{
	var rowCount = this.rows.Count;
	var columnCount = this.columns.Count;
	for (int ri = 0; ri < rowCount; ri++)
	{

		ITableCell cell = null;
		for (var ci = 0; ci < columnCount; ci += cell.ColumnSpan)
		{
			cell = this.CellAt(ri, ci);
			
			// having in mind how the inner 'for' advances, 'cell.ColumnIndex == ci' is always true
			if (cell.RowIndex == ri)
			{
				action(cell);
			}
		}
	}
}

Unfortunately, it is not clear to me what may be the Null reference from the error message. This particular method hasn't changed since your previous Reporting version.

Did you upgrade your project with the Upgrade Wizard?

Did you follow the recommendations from the KB article Upgrading old projects to the latest Telerik Reporting version? Note that since our API may have changed, you may need to upgrade to intermediate versions first.

Do you use custom code in your Reporting-related part of the project? If so, you need to take care of its upgrade manually.

If you manipulate the report with code, for example, in the Report events, please, consider the KB article Changes on items in report events are not applied. It describes a major change we introduced in 2016.

Last but not least, I strongly recommend migrating to the Html5 Web Forms Viewer.

Regards,
Todor
Progress Telerik
Brand new Telerik Reporting course in Virtual Classroom - the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products. Check it out at https://learn.telerik.com/.
Oliver
Top achievements
Rank 1
commented on 01 Apr 2023, 12:20 PM

Hi Todor,

it took me a while to investigate the issue further but now I can answer your questions with enough confidence.

Apart from the Visual Studio version we are already using we want to migrate to the Reporting Server. Therefore I tested our report with the standalone Report Designer first. I got it to work up until Version R3 2017. The same goes for the VS version, although R3 2017 already starts showing "Object not set to an instance" message boxes but then proceeds normally.

As far as I understand there is no such things as an upgrade wizard necessary for the Report Designer. I could just open the TRDP file in any verison in my tests. I would assume it also uses the HTML5 Web Forms Viewer, at least I couldn't find any way to define which viewer should be used.

We are using a few custom functions which I put in a library to be loaded with the Report Designer and that worked till R3 2017. Starting with R3 2018 the same issue as with the VS version comes back. Just to be absolutely confident I removed every external function call and replaced it with a hard coded "1" as value but to no avail.

Since the major changes you mentioned were already in 2016 and those version work I'm now out of ideas what else it could be. I attached the version where I removed all external function calls (hopefully) for you to reproduce the error. Since I have more reports with the same issue I'd also need to know how to change those if you manage to find the issue.

Thanks again

Todor
Telerik team
commented on 03 Apr 2023, 02:12 PM

Hi Sasha and Oliver,

As explained in the support ticket you opened on the same issue, the investigation showed that in the report there are multiple table rows with Height="0cm", which is currently an invalid value. The newer versions of our Report Designers warn if you try to make a row height less than "10px", however, the older reports may still have zero row heights in their definitions, as in this case.

I have logged a bug report on your behalf for the non-informative message in the exception - A Table Cell with TextBox with Height=0 breaks the report with a Message that doesn't Indicate the Exact Problem.

Currently, the solution is to change the row heights to at least  "10px".

Tags
DataSources Report Viewer - ASP.NET Upgrade
Asked by
Oliver
Top achievements
Rank 1
Answers by
Todor
Telerik team
Share this question
or