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

Object reference not set to an instance of an object. Source error line 160

4 Answers 830 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jess
Top achievements
Rank 1
Jess asked on 18 Aug 2014, 11:16 PM
Hi There

I'm trying to support a program that was developed by an external contractor. I have little programming knowledge and was hoping someone could help me investigate and resolve this error.

Thanks ! 

The following error appears:

Server Error in '/' Application.
--------------------------------------------------------------------------------Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.Source Error:
Line 158:                        <telerik:GridBoundColumn DataField="DateAcquired" HeaderText="Date Acquired" DataFormatString="{0:d}" />                       
Line 159:                        <telerik:GridTemplateColumn HeaderText="Grid Codes" >                          
Line 160:                            <ItemTemplate><nobr><%# FormatArray((string[]) Eval("GridCodes")) %></nobr></ItemTemplate>
Line 161:                        </telerik:GridTemplateColumn>                       
Line 162:                        <telerik:GridTemplateColumn HeaderText="Users" >                          
 

Source File: c:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\CONTROLTEMPLATES\SSP.SP.ItAssets\HardwareSearch.ascx   
Line: 160

Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
   Microsoft.SharePoint.Linq.FieldRef.GetHashCode() +17
   Microsoft.SharePoint.Linq.FieldRefEqualityComparer.GetHashCode(FieldRef obj) +18
   System.Linq.Set`1.InternalGetHashCode(TElement value) +69
   System.Linq.Set`1.Find(TElement value, Boolean add) +126
   System.Linq.<DistinctIterator>d__7a`1.MoveNext() +388
   System.Linq.Buffer`1..ctor(IEnumerable`1 source) +470
   System.Linq.Enumerable.ToArray(IEnumerable`1 source) +52
   Microsoft.SharePoint.Linq.SelectMappingInfo.GetDistinctMappedFields() +167
   Microsoft.SharePoint.Linq.Rules.SelectWithInfoOp.PushDownSelect(Context ctx) +253
   Microsoft.SharePoint.Linq.Rules.SelectWithInfoOp.Process(Context ctx) +38
   Microsoft.SharePoint.Linq.Rules.<>c__DisplayClass7.<.ctor>b__6(TSourceBase src, TContext ctx) +52
   Microsoft.SharePoint.Linq.Rules.RewriteRule`2.Apply(TNode src, TContext ctx) +209
   Microsoft.SharePoint.Linq.Rules.CacheRule`3.Apply(TSource src, TContext ctx) +259
   Microsoft.SharePoint.Linq.Rules.PushDownProcessor.<.cctor>b__0(Expression e, Context ctx) +65
   Microsoft.SharePoint.Linq.Rules.ChildRule`2.Apply(TNode src, TContext ctx) +644
   Microsoft.SharePoint.Linq.Rules.PushDownProcessor.<.cctor>b__3(Expression e, Context ctx) +272
   Microsoft.SharePoint.Linq.Rules.RewriteRule`2.Apply(TNode src, TContext ctx) +209
   Microsoft.SharePoint.Linq.Rules.CacheRule`3.Apply(TSource src, TContext ctx) +259
   Microsoft.SharePoint.Linq.Rules.PushDownProcessor.<.cctor>b__0(Expression e, Context ctx) +65
   Microsoft.SharePoint.Linq.Rules.ChildRule`2.Apply(TNode src, TContext ctx) +644
   Microsoft.SharePoint.Linq.Rules.PushDownProcessor.<.cctor>b__3(Expression e, Context ctx) +272
   Microsoft.SharePoint.Linq.Rules.RewriteRule`2.Apply(TNode src, TContext ctx) +209
   Microsoft.SharePoint.Linq.Rules.CacheRule`3.Apply(TSource src, TContext ctx) +259
   Microsoft.SharePoint.Linq.SPLinqProvider.Rewrite(Expression expression, List`1& assumptions) +92
   Microsoft.SharePoint.Linq.SPLinqProvider.RewriteAndCompile(Expression expression, List`1& assumptions) +97
   Microsoft.SharePoint.Linq.LinqQuery`1.GetEnumerator() +290
   System.Linq.Buffer`1..ctor(IEnumerable`1 source) +301
   System.Linq.Enumerable.ToArray(IEnumerable`1 source) +107
   SSP.SP.ItAssets.Data.Hardware.get_GridCodes() +1129[TargetInvocationException: Property accessor 'GridCodes' on object 'SSP.SP.ItAssets.Data.Hardware' threw the following exception:'Object reference not set to an instance of an object.']
   System.ComponentModel.ReflectPropertyDescriptor.GetValue(Object component) +7182648
   System.Web.UI.DataBinder.GetPropertyValue(Object container, String propName) +96
   System.Web.UI.DataBinder.Eval(Object container, String[] expressionParts) +148
   ASP._controltemplates_SSP_sp_itassets_hardwaresearch_ascx.__DataBind__control26(Object sender, EventArgs e) in c:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\CONTROLTEMPLATES\SSP.SP.ItAssets\HardwareSearch.ascx:160
   System.Web.UI.Control.OnDataBinding(EventArgs e) +132
   System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +170
   System.Web.UI.Control.DataBindChildren() +11143327
   System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +182
   System.Web.UI.Control.DataBindChildren() +11143327
   System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +182
   Telerik.Web.UI.GridItem.SetupItem(Boolean dataBind, Object dataItem, GridColumn[] columns, ControlCollection rows) +756
   Telerik.Web.UI.GridItemBuilder.InitializeItem(Int32 dataSourceIndex, String& nextItemHierarchicalIndex, Boolean& itemIsInEditMode) +192
   Telerik.Web.UI.GridItemBuilder.CreateItems(GridGroupingContext group) +438
   Telerik.Web.UI.GridTableView.CreateItems(IEnumerator enumerator, GridColumn[] columns, ControlCollection controls) +137
   Telerik.Web.UI.GridTableView.CreateControlHierarchy(Boolean useDataSource) +1254
   Telerik.Web.UI.GridTableView.CreateChildControls(IEnumerable dataSource, Boolean useDataSource) +640
   System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +72
   System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +147
   System.Web.UI.WebControls.DataBoundControl.PerformSelect() +261
   Telerik.Web.UI.GridTableView.PerformSelect() +23
   Telerik.Web.UI.GridTableView.DataBind() +363
   Telerik.Web.UI.RadGrid.DataBind() +73
   SSP.SP.ItAssets.ControlTemplates.SSP.SP.ItAssets.HardwareSearch.btnSearch_OnClick(Object sender, EventArgs e) +279
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +115
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +140
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +29
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2981 

4 Answers, 1 is accepted

Sort by
0
Jess
Top achievements
Rank 1
answered on 19 Aug 2014, 01:46 AM
We thought it might be data-related and have removed a most recent entry and one othe entry that didn't look right. However no change.
0
Accepted
Marin
Telerik team
answered on 21 Aug 2014, 10:26 AM
Hi,

The databinding of the grid is failing in this case. Most likely Eval("GridCodes") is evaluated as null which causes the Object reference not set to an instance of an object.  error that you see.
You can check the setup of the databinding  - for example are you using the NeedDataSource event and what object is passed as DataSource for the control. Additionally the resolved datasource should also contain a property called GridCodes so that it can be properly evaluated at runtime.
You can also check if the error is related to the databinding expressions like <%# FormatArray((string[]) Eval("GridCodes")) %> and whether it is replicated if you temporary comment the template columns containing such expressions. 

Regards,
Marin
Telerik
 
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
 
0
Suresh
Top achievements
Rank 1
answered on 15 Apr 2015, 11:23 AM

 HI All,

Telerik rad grid has been using my application and it is enabled filtering/sorting and paging. Everything is working fine.

But intermittently, grid is displaying empty when page index change or sorting on header of the grid. My observations, it is not hitting page load event also at serverside. I believe Telerik rad grid is using some asynch call from clientside and causing the issue intermittently. if it is hitting page load it must be captured in try catch block.

I don't have any client side event handling and rad ajax on the page.

Please help to resolve the issue. It is intermittent and annoying a lot for sorting and page number click events.

------------------------------------------------------------------------- 

Application error when access
/_layouts/15/Tesla.SHP.Adhoc.Web/ExecutedRequests.aspx, Error=Object reference
not set to an instance of an object.   at
Telerik.Web.UI.RadGrid.RaisePostBackEvent(String
eventArgument)     at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
98b3fc9c-e2e2-80be-6086-19431aa1a018

04/14/2015 10:49:22.13 w3wp.exe
(0x0314)              
         0x0300  SharePoint
Foundation        
        Runtime                      
               
tkau      
Unexpected       System.NullReferenceException:
Object reference not set to an instance of an object.    at
Telerik.Web.UI.RadGrid.RaisePostBackEvent(String
eventArgument)     at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
98b3fc9c-e2e2-80be-6086-19431aa1a018

04/14/2015 10:49:22.14 w3wp.exe
(0x0314)                      
0x0300  SharePoint Foundation        
       
General                      
               
ajlz0       High      
Getting Error Message for Exception System.Web.HttpUnhandledException
(0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown.
---> System.NullReferenceException: Object reference not set to an instance
of an object.     at
Telerik.Web.UI.RadGrid.RaisePostBackEvent(String
eventArgument)     at
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,
Boolean includeStagesAfterAsyncPoint)     at
System.Web.UI.Page.HandleError(Exception e)     at
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,
Boolean includeStagesAfterAsyncPoint)     at
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint,
Boolean includeStagesAfterAsyncPoint)     at
System.Web.UI.Page.ProcessRequest()     at
System.Web.UI.Page.Process...               
98b3fc9c-e2e2-80be-6086-19431aa1a018

04/14/2015
10:49:22.14*              
w3wp.exe (0x0314)

0
Marin
Telerik team
answered on 16 Apr 2015, 11:33 AM
Hello,

We have replied to your other forum post on the same issue
http://www.telerik.com/forums/error=object-reference-not-set-to-an-instance-of-an-object-at-telerik-web-ui-radgrid-raisepostbackevent(string-eventargument)

We can continue the communication there to avoid duplicate posts.

Regards,
Marin
Telerik
 
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
 
Tags
General Discussions
Asked by
Jess
Top achievements
Rank 1
Answers by
Jess
Top achievements
Rank 1
Marin
Telerik team
Suresh
Top achievements
Rank 1
Share this question
or