SetSectionLinks() and “Object reference not set to an instance of an object”

OK, this was driving me insane …

About 4 weeks ago I noticed on my development SharePoint farm, that whatever list I went to, whenever I tried to view the List Settings I would get the error below:

NullReferenceException: Object reference not set to an instance of an object.]    Microsoft.SharePoint.ApplicationPages.ListEditPage.SetSectionLinks() +426    Microsoft.SharePoint.ApplicationPages.ListEditPage.OnLoad(EventArgs e) +896    ASP._layouts_listedit_aspx.OnLoad(EventArgs e) +290    System.Web.UI.Control.LoadRecursive() +65    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2427

I thought at first it must have been me , as I was playing around with Custom Actions at the time. I couldn’t see anything obvious so I ended up re-installing my development SharePoint farm. I then had to go off and do other work, when I got back I found that the same thing was happening!  I decided to start ploughing my way through DLLs using Reflector and tracked down the issue to something around a control on the ListEdit.aspx page, but again I got dragged away.  Back to my development farm today, the issue was still present, I wondered if anybody had solved this issue and full credit to this partner on this forum post they yesterday identified the culprit and it’s really probably only a Development box issue, at least it should be …

Basically the error was due to an older version of Microsoft.SharePoint.ApplicationPages.dll existing in the GAC.  That DLL is not by default in the GAC, but it has gotten in there due to a TFS/Project Structure requirement.  Of course, along comes SP1 which updates Microsoft.SharePoint.ApplicationPages.dll  in the _app_bin folder of each Web Application which is where it normally sits, and also updates ListEdit.aspx  in the Layouts folder.  Lo and behold a control is removed from the ListEdit.aspx page but somehow the GAC version is still loaded which causes the error.

To resolve the error do one of two things:

  • Remove the Microsoft.SharePoint.ApplicationPages.dll from the GAC, or …
  • If your TFS/Project Development Pattern means you need/would like a copy in the GAC, then you must update your copy in the GAC to the same version as exists in the _app_bin folder using GACUTIL.

It worked a treat for me.

I’m puzzled though … I thought that the _app_bin version always took precedent over the GAC version? Or is that just the bin version?  Any thoughts anybody?

Cheers

Dave Mc

Advertisements

About davemcmahon81
Software Developer & Architect, User Group Leader, Speaker, Writer, Blogger, Occasional Guitarist, Man-made Global Warming Sceptic, Climate Change Believer, General Optimist but most of all proud Husband and Dad ...

2 Responses to SetSectionLinks() and “Object reference not set to an instance of an object”

  1. Pingback: Sharepoint Updates December-02-2011 | SDavara's Sharepoint Knowledge Center

  2. Jeremy Collins says:

    Thanks! You’re a life saver. As far as GAC’d DLLs vs. _app_bin goes, I though the GAC always wins. I don’t know for sure.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: