Tuesday, June 12, 2012

How to fix "System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.SharePoint.SPField.GetTypeOrBaseTypeIfTypeIsInvalid" ?

What?

I suddenly started to see an exception "An unexpected error has occurred" in our SharePoint 2010 site when I tried to access the site's landing page.







After digging through the logs, the exception actually is:

"System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.SharePoint.SPField.GetTypeOrBaseTypeIfTypeIsInvalid"
Google has returned no results for this unique exception.

The same exception has shown up on every page in the root site. All the sub-sites were doing fine.

Why?

It is obvious that this exception is specific to one site's pages library. All the pages in other sub-sites are working fine.

How?

I went into the pages library settings and then found that there are number of invalid fields.

I have also seen a strange link that appeared next to each invalid field that says "Delete this invalid field".

I went ahead and deleted all the invalid fields and woohoo all the pages in the root site are back and working properly.

No comments:

Post a Comment