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

Object reference not set to an instance of an object

11 Answers 3084 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Steven
Top achievements
Rank 1
Steven asked on 22 Jan 2013, 05:50 AM
I've converted a huge report from SSRS to Telerik, but when the report tries to render with a table visibility set to false I'm getting a generic error message

"Object reference not set to an instance of an object"

It would be nice to get a little bit of more information about where and why.


How can I determine what element is causing this error?
Is there any way to debug the extension methods or at least have them dump the debugging to a text file.

Thanks
Steve

11 Answers, 1 is accepted

Sort by
0
Ristogod
Top achievements
Rank 2
answered on 22 Jan 2013, 09:01 PM
We are getting the same issue. I rolled back to the previous version 6.2.12.1017 and the issue disappeared. The issue appears to be coming from the WpfViewer for us.
0
Stef
Telerik team
answered on 24 Jan 2013, 05:58 PM
Hi everyone,

As this is not a known issue to my knowledge and the information you've provided is insufficient, it is hard to provide you with any specific suggestions.
Do you get the exception at design time or only at run time?
@Steven: Do you have any specific coding and on what criteria does the table get hidden? For debugging purposes I can suggest you using IntelliTrace.
@Nathan: what is your user case and can you provide error logs?

If any of you can send us a runnable sample illustrating the issue, it will be very helpful in getting to the source.

All the best,
Stef
the Telerik team

HAPPY WITH REPORTING? Do you feel that it is fantastic? Or easy to use? Or better than Crystal Reports? Tell the world, and help fellow developers! Write a short review about Telerik Reporting and Telerik Report Designer in Visual Studio Gallery today!

0
Steven
Top achievements
Rank 1
answered on 24 Jan 2013, 10:55 PM
Thanks for the IntelliTrace tip.

The error seams to be caused within the Telerik.Reporting.Processing.Table.ForEachCell(action) call to calculate the stack height.

I've received this error before when a table cell was missing but I've re-verified every table SetCellContent call and can't find an immediate issue.

I have 10 tables stacked on top of each other which was working fine, but I needed to shuffle some of the tables around and the absolute positioning was a pain to manage so I stacked them into a List where each static row is a table and the details row is not shown.  This way there location is driven from the row and I can just change the Row order from the .designer file.

I was setting the table visibility to false, but a table acting as a tablecell I've changed the visibility back to true and just hid tables through a static row filter (True = False) for tables that aren't 100% complete yet.


I'm still getting the object does not exist from the Lists tableCell iteration, but I have a small hunch that my tables within the list got screwed up when I Cut/Pasted them into the List Row, and perhaps some textboxes have been added to multiple tables.

Visual Studio also freezes allot with this report since I moved it into the List and figure its because of the same reason.

0
Ristogod
Top achievements
Rank 2
answered on 25 Jan 2013, 03:12 PM
In the past year, every version up until 6.2.12.1025 had a show stopping bug that prevented us from being able to upgrade and fix other known issues. When attempting to update I was forced to spend days trying to recreate the issue so I could prove it to you and you'd fix it. I don't have the time to play that game at every reporting release. So you'll get nothing more out of me on the subject and will just have to believe me that there is this bug and how you recreate it is upon you or anyone else willing to help. I'll just stick with the previous non-broken version.
0
Steven
Top achievements
Rank 1
answered on 25 Jan 2013, 06:10 PM
I followed the suggestion of a different post regarding nested tables and put each table within a panel


[This Didn't Work]
List
  - Panel (Detail Section)
  - Table
  - Table
  - Table


[This Works]
List
   - Panel (Detail Section)
   - Panel
       - Table
   - Panel
       - Table
   - Panel
       - Table


My original issue was that the error message did not give any helpful information and would love a bit more verbose error message that would help in troubleshooting the issue.  something like:

  - ITableCell.Item reference is not set to an instance of an object {TableName} {RowIndex} {ColumnIndex}
0
Stef
Telerik team
answered on 30 Jan 2013, 09:16 AM
Hi,

@Steven: I am glad to hear that you have managed to find a solution for your second issue. As for the error message we do agree that it is insufficient to determine where the problem is and will make it more verbose for the next release. Please, note as well, that for every exception you can see the complete stack trace in the Visual Studio's Output window.

@Nathan: Without having enough information on how to reproduce a certain issue it is hard to investigate it. If you are receiving a null reference exception you can at least send us the stack trace so that we can check what might be causing it. There is no need to always prepare a sample project unless the issue is very complex to reproduce and there are no other clues to solve it.

All the best,
Stef
the Telerik team

HAPPY WITH REPORTING? Do you feel that it is fantastic? Or easy to use? Or better than Crystal Reports? Tell the world, and help fellow developers! Write a short review about Telerik Reporting and Telerik Report Designer in Visual Studio Gallery today!

0
Stephanie
Top achievements
Rank 1
answered on 08 Mar 2013, 06:26 PM
I am experience this problem as well. The uninformative message is displayed only when my sqldatasource object returns rows. No data returned, I get my report displayed with no data but at least it displays.  I've tried looking at the stack trace (see first few lines below) but I've no clue where to go with it, any help would be greatly appreciated! I'm currently in VS 2008 (framework 3.5) and just upgraded to the latest version of the reporting tools.

[NullReferenceException: Object reference not set to an instance of an object.]
   Telerik.Reporting.Paging.PagingElementBase.Init(LayoutElement source, PagingElementBase parent, IComposition composition, InitializationContext initContext) +132
   Telerik.Reporting.Paging.ElementFactory.CreateElement(LayoutElement source, PagingElementBase parent, IComposition composition, InitializationContext initContext) +80
   Telerik.Reporting.Paging.PageCompositionBase.CreateElement(LayoutElement source, PagingElementBase parent, InitializationContext initContext) +72
   Telerik.Reporting.Paging.PagingElementBase.CreateContent(InitializationContext initContext) +193
   Telerik.Reporting.Paging.PagingElementBase.Init(LayoutElement source, PagingElementBase parent, IComposition composition, InitializationContext initContext) +481
   Telerik.Reporting.Paging.ElementFactory.CreateElement(LayoutElement source, PagingElementBase parent, IComposition composition, InitializationContext initContext) +80
   Telerik.Reporting.Paging.PageCompositionBase.CreateElement(LayoutElement source, PagingElementBase parent, InitializationContext initContext) +72
   Telerik.Reporting.Paging.PagingElementBase.CreateContent(InitializationContext initContext) +193
  
  
0
Stephanie
Top achievements
Rank 1
answered on 11 Mar 2013, 09:06 PM
Update to my post above, the report renders perfectly fine in the report class designer/preview.  It's when I attempt to export or view the report in the web page that I have no report rendered.  PLEASE HELP!!!
0
Steven
Top achievements
Rank 1
answered on 12 Mar 2013, 01:58 AM
The "Telerik.Reporing.Table" in the designer is the ItemDefintion. The processing engine creates a "Telerik.Reporting.Processing.Table" that utilizes the ItemDefinition as a reference to the default styles, grouping, filtering, conditional formatting........  that it needs to process.


Because the table is never processed (in your working example) their may be an issue with your ItemDefinition.

You could always click on the Row or Column and change to the Background Color to see if you are missing any cells.

To calculate the table measurements it calls an internal ForEach to iterate and call an Action<Telerik.Reporting.Process.ITableCell> delegate which is what was throwing the error in my case.



If it renders fine with data some of the time then I would expect that you may be modifying some part of the Item definition before it finishes binding.  If you are tweaking the table, columns, rows or table cell VISIBILITY at any event I would suggest commenting out the code in these events and then un-comment them one by one to determine which one is causing you problems.

The Designer may not fire all of the same events that the ReportViewer/Rendering Extensions would


Also a great hint I received from Telerik was to use IntelliTrace - it rocks.
http://msdn.microsoft.com/en-us/library/vstudio/dd264915.aspx





Steve




0
Stef
Telerik team
answered on 13 Mar 2013, 04:07 PM
Hi,

@Steven: Thank you for the provided information and the effort to help other community members.

@Stephanie and anyone concerned: According to the stack trace it looks like an issue with the Crosstab item where a row or column has height or width value set to zero - appears in the latest internal build v7.0.13.228. The fix will be available in the next release, meanwhile you can handle this as described by Steven (widen the empty row/column and find any empty cells and manually add TextBox items into them, then you will be able to delete the unnecessary row/column) or downgrade to Q1 2013 v7.0.13.220(the major version) or Q3 2012 SP1. If the described is not your case, please open a support ticket and send us your report definition for further tests. We will update the forum thread in the end.

As far as the records show, we have not reproduced the problem with versions prior to 7.0.13.228, so it is not related to the other mentioned issues in the discussion. If you have runnable sample projects indicating the opposite, we will be thankful to send them to us in a support ticket for review. In older versions the "Object reference not set to an instance of an object" message appears in cases of manual hiding/removing of items from the Crosstab definition.

I hope this helps.

Greetings,
Stef
the Telerik team

Telerik Reporting Q1 2013 available for download with impressive new visualizations. Download today from your account.

0
Stephanie
Top achievements
Rank 1
answered on 13 Mar 2013, 04:24 PM
Thank you for all information posted.  I first recreated the report and found that there was an existing "hidden" row with a height of zero (I was not the original developer here), however this functionality is desired so I also downgraded to version Q3 2012 SP1 and all works as expected.
Tags
General Discussions
Asked by
Steven
Top achievements
Rank 1
Answers by
Ristogod
Top achievements
Rank 2
Stef
Telerik team
Steven
Top achievements
Rank 1
Stephanie
Top achievements
Rank 1
Share this question
or