Sunday, 2 May 2010 07:22
| 1 Comments |
It's open season for hunting down SharePoint 2010 bugs and I've found a particularly ugly one. I created a site from a site template, and when I went in to the solution gallery and deactivated the solution (after the site was created) the solution gallery began throwing an exception:
[NullReferenceException: Object reference not set to an instance of an object.]
Microsoft.SharePoint.WebPartPages.ListViewWebPart.PrepareContentTypeFilter(SPList list, Hashtable excludedTransformers) +176
Microsoft.SharePoint.WebPartPages.ListViewWebPart.GenerateDocConvScriptBlock(SPWeb web, SPList list) +482
Microsoft.SharePoint.WebPartPages.ListViewWebPart.OnPreRender(EventArgs e) +1957
Microsoft.SharePoint.WebPartPages.WebPartMobileAdapter.OnPreRender(EventArgs e) +78
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3393
The specific steps are really simple…
- Create a blank site.
- Save site as a template.
- Create a new site collection but don't establish a template
- Upload the template created in step #2 to the solution gallery and activate
- Create the site with the template.
- Go to the solution Gallery and deactivate the solution.
If you want or need to get back to a partially useful state you can do the following steps in the SharePoint Management Shell..
$site = get-spsite http://localhost/sites/mysitehere
$solutions = $site.Solutions
The moral to this story is don't deactivate the site template that you created a site from (at least not at the moment). In SharePoint 2007 you could remove a site template's STP file once the site was created because the STP file was essentially a macro that replayed the creation steps over the existing site definition. However, this isn't the case with the new WSP format. The source of the items including content types is tracked, and may be removed if you remove the site template.