Community Update
It’s nice to see the community providing feedback on my tools and improving them. I strongly encourage this and here’s another example of this kind of interaction.
Achim Ismaili has improved the FaultyFeatureTool and added it to codeplex: http://featureadmin.codeplex.com/
Be sure to check it out !
Problem
Using the STSADM.EXE tool for exporting a Site Collection to a file may result in the following error in the log file
[8/23/2007 9:24:56 AM]: Start Time: 8/23/2007 9:24:56 AM.
[8/23/2007 9:24:56 AM]: Progress: Initializing Export.
[8/23/2007 9:24:57 AM]: Progress: Starting Export.
[8/23/2007 9:24:57 AM]: Progress: Calculating Objects to Export.
[8/23/2007 9:25:00 AM]: Progress: Serializing Objects to Disk.
[8/23/2007 9:25:00 AM]: Progress: Starting to process objects of type Site.
[8/23/2007 9:25:01 AM]: Progress: Finished processing objects of type Site.
[8/23/2007 9:25:01 AM]: Progress: Starting to process objects of type Web.
[8/23/2007 9:25:01 AM]: Progress: Exporting Web http://moss2007dev.
[8/23/2007 9:25:01 AM]: FatalError: Failed to compare two elements in the array.
at System.Collections.Generic.ArraySortHelper`1.QuickSort[TValue](T[] keys, TValue[] values, Int32 left, Int32 right, IComparer`1 comparer)
at System.Collections.Generic.ArraySortHelper`1.QuickSort[TValue](T[] keys, TValue[] values, Int32 left, Int32 right, IComparer`1 comparer)
at System.Collections.Generic.ArraySortHelper`1.QuickSort[TValue](T[] keys, TValue[] values, Int32 left, Int32 right, IComparer`1 comparer)
at System.Collections.Generic.ArraySortHelper`1.Sort[TValue](T[] keys, TValue[] values, Int32 index, Int32 length, IComparer`1 comparer)
at System.Collections.Generic.ArraySortHelper`1.Sort(T[] items, Int32 index, Int32 length, IComparer`1 comparer)
at System.Array.Sort[T](T[] array, Int32 index, Int32 length, IComparer`1 comparer)
at System.Collections.Generic.List`1.Sort(Int32 index, Int32 count, IComparer`1 comparer)
at System.Collections.Generic.List`1.Sort(IComparer`1 comparer)
at Microsoft.SharePoint.Deployment.WebSerializer.GetDataFromObjectModel(Object obj, SerializationInfo info, StreamingContext context)
at Microsoft.SharePoint.Deployment.DeploymentSerializationSurrogate.GetObjectData(Object obj, SerializationInfo info, StreamingContext context)
at Microsoft.SharePoint.Deployment.XmlFormatter.SerializeObject(Object obj, ISerializationSurrogate surrogate, String elementName, Boolean bNeedEnvelope)
at Microsoft.SharePoint.Deployment.XmlFormatter.Serialize(Stream serializationStream, Object topLevelObject)
at Microsoft.SharePoint.Deployment.ObjectSerializer.Serialize(DeploymentObject deployObject, Stream serializationStream)
at Microsoft.SharePoint.Deployment.SPExport.SerializeObjects()
at Microsoft.SharePoint.Deployment.SPExport.Run()
*** Inner exception:
Object reference not set to an instance of an object.
at Microsoft.SharePoint.SPFeature.EnsureProperties()
at Microsoft.SharePoint.SPFeature.get_TimeActivated()
at Microsoft.SharePoint.Deployment.WebSerializer.ExportFeatureComparer.System.Collections. Generic.IComparer.Compare(ExportObject exportObject1, ExportObject exportObject2)
at System.Collections.Generic.ArraySortHelper`1.QuickSort[TValue](T[] keys, TValue[] values, Int32 left, Int32 right, IComparer`1 comparer)
[8/23/2007 9:25:01 AM]: Progress: Export Completed.
[8/23/2007 9:25:01 AM]: Finish Time: 8/23/2007 9:25:01 AM.
[8/23/2007 9:25:01 AM]: Completed with 0 warnings.
[8/23/2007 9:25:01 AM]: Completed with 1 errors.
Cause
In my case the cause was an invalid Feature registration in the Site Collection (SPSite) or root Site (SPWeb).
Solution
I have written a small tool to enumerate all features of a site and its site collection. When you find an invalid feature you can delete it using the Feature ID and STSADM.
Usage
Run the tool locally on the SharePoint Server and enter the URL to the problematic site (in my case the root site). When a valid feature is returned you will get the Feature Title and the Feature Id. When an invalid feature is returned you will only get the Feature Id.
Use the Feature Id in the STSADM tool to force remove the feature:
eg. STSADM -o deactivatefeature -id 11cda100-5a8c-4f39-a149-0fd3f86b5e98 -url http://localhost -force
Afterwards you can run the tool again to verify if the feature is removed. You should now be able to export the site collection... At least I was...
Screenshot
Applies to
Windows SharePoint Services 3.0, Microsoft Office SharePoint Server 2007 (because of the use of the Feature Framework)
Download
-
Executable
-
Visual Studio 2008 solution