ListInstance and “Object reference not set to an instance of an object”

I had some trouble with a ListInstance feature today, which was activated through a custom site definition. This resulted in quite some frustration, so I was glad to finally find the solution.

Thanks to the blog post on http://sigurbjorn.wordpress.com/2008/07/21/listinstance-and-object-reference-not-set-to-an-instance-of-an-object, It got solved. Thanks Sigurbjörn !

Description
While activating a feature that contains list instances I get an “Unknown error” message in the SharePoint UI.

Log Entry
The element ‘NameOfListInstance’ of type ‘ListInstance’ for feature ‘MyCompany.SharePoint’ (id: 00000000-0000-0000-0000-000000000000) threw an exception during activation: Object reference not set to an instance of an object.

My solution
After a lot of debugging I noticed that if I remove the RootWebOnly=”TRUE” attribute from the ListInstance element the error goes away.

Leave a Reply