Home Sign In

Steven Van de Craen's Blog

Bloggings about SharePoint, .NET and more.

MVP SharePoint Server

RSS Feed
  • Contact Me

Archives

July 2007 (19)
August 2007 (5)
April 2008 (4)
September 2007 (3)
November 2007 (12)
October 2007 (4)
December 2007 (8)
January 2008 (6)
February 2008 (3)
March 2008 (4)

Categories

  • SharePoint 2003
  • SharePoint 2007
  • General
  • Office 2003
  • Office 2007
  • Excel Services
  • Dynamics NAV
  • SOAP
  • Search
  • Search Server 2008
  • .NET
  • CKS
  • IIS

Recent Posts

  • Rooms and Equipment Reservations v2 (UNOFFICIAL)
  • Being a SharePoint MVP...
  • New MVP on the block
  • Aggregating MySite Blogs
  • Synchronous and asynchronous Event Handlers

Other Blogs

//BLOG: naked programmer
JOPX
Jan Tielens' Bloggings [MVP]
Serge van den Oever [Macaw]
Carlos Segura Sanz
-->Patrick Tisseghem's Blog [MVP SharePoint] -->
Remco Ploeg's Blog
SharePoint Blogs
Romeo Pruno
[email protected]
Andrew Connell [MVP MOSS]
Mark Harrison
Pedro Serrano
Clemens Vasters and the Indigettes
Kevin Boske
SharePoint Team Blog
Brian Jones: Office XML Formats
Mart Muller's Sharepoint Weblog
Joel Oleson's SharePoint Land
Kris' blog
STSADM Custom Extensions
Microsoft Enterprise Search Blog
Michaël's coding thoughts
Chris O'Brien's blog
John Holliday's SharePoint Reflections
Koen's blog
PDT IT Services Blog Posts

STSADM -o export: FatalError: Failed to compare two elements in the array

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

v2 Update

Using the STSADM method it is not possible to remove an erroneous feature from a sub web.

This version (v2) allows you to select and remove the erroneous features from within the application.

 
Categories: SharePoint 2007, .NET

Trackback Url

 

Comments

Thursday, 27 Dec 2007 07:53 by Phill Duffy
Thank you so much, a very useful tool indeed and a big thank you for the source code too it.

Thursday, 27 Dec 2007 07:53 by David Remillard
Thanks a lot for this. I've been struggling with this issue for a couple days now. Very much appreciated!

Thursday, 27 Dec 2007 07:53 by Hexane
This was huge. Helped me get past my issue with this. /me tucks this tool away in my toolbox.

Thursday, 27 Dec 2007 07:53 by Etienne Lambert
Steve, you're the man. Thank you for the tool & code!!!

Thursday, 27 Dec 2007 07:53 by Alan
Great tool! Fixed the problem. Thanks

Thursday, 27 Dec 2007 07:53 by Steven Van de Craen
I have finalized the Contact Form. From now on you can contact me using the contact.aspx page ;)

Thursday, 27 Dec 2007 07:53 by Nigel
Hi Steven - I have run your tool and it works great ! - however, I have a problem - your tool reports an invalid feature at a web which not the root web eg :- http://myweb.com/thisweb and I cant remove it using stsadm as suggested as it says you must remove it from the root site - which I did - but your tool still reports the error in the sub site Nigel

Thursday, 27 Dec 2007 07:53 by Steven Van de Craen

Hi Nigel,

I did some testing and it was not possible using STSADM. I have released a newer version of the tool that should let you delete the features instantly. Be careful ! This tool will delete *any* feature you select, also working ones.

Steven


Thursday, 27 Dec 2007 07:53 by Babak
I've been researching this 'Object reference not set to an instance of an object' error when I try to deploy my Webpart via Visual Studio 2005 for over a week now. This tool has been the only helpful item I've found anywhere on the web relating to this issue. I ran the tool, removed the corrupt feature, and the deployment worked for the first time in a week.

Thursday, 27 Dec 2007 07:53 by Aries
Hi Steve, I can't backup my site after I installing some feature and almost getting upset about it. Your post so helpful. Really thanks ^^

Thursday, 27 Dec 2007 07:53 by Serge van den Oever [Macaw]
Hi Steven, thanks for this great tool. I was completely stuck developing my own tool for exporting SharePoint content using SPExport. I could never have quessed that a faulty feature was the reason that I got the "Failed to compare two elements in the array" exception. I will add this to my toolbox, and drink a beer on your health tonight!! Serge

Thursday, 27 Dec 2007 07:53 by Norm Smith
Great little tool. Simple, Straightforward, no gimmicks - Problem Solved!!! Thank you!

Thursday, 27 Dec 2007 07:53 by David Dean
Thanks a bunch for your post and your utility, Steven. This was exactly my problem and saved me a bunch of head-scratching.

Thursday, 27 Dec 2007 07:53 by Mel Alberti
Hi Steven, this sounds like a great tool. I'm trying to run it on my local SharePoint install but am getting the infamous "Request for the permission of type 'Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' failed" error. I tried setting the trust setting in web.config for my virtual server to "Full" and did an iisreset, but I still see the error. Is there something else I need to do at the server or SharePoint level to get rid of this error? Thanks!

Thursday, 27 Dec 2007 07:53 by Mel Alberti
Well, just answered my own question. I was running this tool from a network drive. As soon as I moved it to the local C: drive, it works fine (with "Full" trust access).

Thursday, 27 Dec 2007 07:53 by Guillermo Pussetto
Hi, I have exactly the same problem, run your tool and voila! errors gone. Thanks a lot G

Thursday, 27 Dec 2007 07:53 by mela
Hi steve! when i ran your tool and there were a lot of error feature. TUrns out there were enterprise feature but we are running on standard edition. the site was migrated to our standard edition. however, when i removed the feature and run the export tools again, there were still error main because the site perhaps may be using the features i uninstalled. any thoughts on what i should do now?

Thursday, 27 Dec 2007 07:53 by Steven Van de Craen
Mela, I don't know what other causes this exception could have, but if it is not solved by removing the features I can't really help you any further. Does the tool still give you errors on certain (site collection or site) features ?

Thursday, 27 Dec 2007 07:53 by mela
hi steven! one of the features that the tool recognized as an error was IPFSWebFeatures (i knew what the feature was after searching that GUID on google). i tried to uninstall it, but when i exported again, it is now looking for this feature also. i tried to install this feature again but again i am again having the error: Failed to compare two elements in the array.

Thursday, 27 Dec 2007 07:53 by merav
thanks a lottttt

Thursday, 27 Dec 2007 07:53 by S.S. A
Hi Steven, Thank you very much! I am glad to hear from you. Yes, I have some interesting stuff lined up, and I am excited about it. Mostly I will publish small tips that would be helpful to the developer community. Thanks once again. Regards, S.S. A p.s I am sorry I couldn't find a link on your blog to send you an email, therefore, I am adding this comment.

Thursday, 27 Dec 2007 07:53 by Wyn
Excellent that you made this tool!! Exactly what I needed and saved so much time.

Sunday, 13 Jan 2008 04:08 by Casey
This tool worked great for me, my only concern is that I deleted features that I need - would that be true? Is it safe to assume that any errors removed would not be working anyway and being currently used in a production environment?

Friday, 18 Jan 2008 05:24 by Steven Van de Craen
I think most of the erroneous features are leftovers from B2TR upgrades or incorrect removed development features. I couldn't see how one of the OOTB features would be corrupted (unless someone deleted the folder in \FEATURES). You could always reactivate the current set of features so that any (hidden) feature dependencies are loaded again just to be safe.

Friday, 25 Jan 2008 08:15 by PhilB
Great tool but I got this on export: Feature 'a0e5a010-1329-49d4-9e09-f280cdbed37d' for list template '10102' is not installed in this farm. The operation could not be completed. Better than before but now what? Ideas welcome. PB

Sunday, 24 Feb 2008 12:12 by Molay Ash
Great tool.It was creating error (Object reference not set to an instance of an object) when I try to deploy my Webpart via Visual Studio 2005 . After removing the particular feature by using this tool the problem has been solved.I think it's the only tool to solve this kind of "Life Hell" error. Thanks

Wednesday, 27 Feb 2008 03:31 by Pete Halverson
Thanks so much, bailed me out of an important migration task. Love it when Googling the problem takes you right to solution!

Tuesday, 18 Mar 2008 07:49 by Bray
Seriously- Good job buddy.

Friday, 21 Mar 2008 03:25 by bgeoffro (MCS)
Great tool. Helped me resolve export issues with sites that had been migrated from a MOSS Enterprise environment to a MOSS Standard environment. One minor issue - the tool only seemed able to remove one feature at each scope (i.e. 1 SPSite-scoped feature and 1 SPWeb-scoped feature or one of either) at a time, even though I had multiple features selected. Is this by design, or a bug?

Sunday, 23 Mar 2008 05:40 by Barry Hohstadt
HI, and thanks for all your work. I ran into a export fatal error though after removing the invalid features: "FatalError: Feature 'a0e5a010-1329-49d4-9e09-f280cdbed37d' for list template '10102' is not installed in this farm. The operation could not be completed." I am now afraid I may have screwed something up, maybe to do with a customized list that was developed for us? Any ideas how to correct? Thanks

Monday, 24 Mar 2008 10:59 by Steven Van de Craen
The tool should be able to remove multiple features at a same time and if it doesn't it is probably a bug.

Monday, 24 Mar 2008 11:01 by Steven Van de Craen
Barry, If you have the custom list solution/feature I suggest you try to force reinstall it. Or if you don't need it anymore you could remove all the bits (like the list template) manually yourself.

Tuesday, 8 Apr 2008 08:03 by Shola Salako
Awesome tool, Steven! Thanks for sharing! Barry, I ran into the same problem. a0e5a010-1329-49d4-9e09-f280cdbed37d corresponds to the IPFSWebFeatures on my server. I reinstalled it using the following command: stsadm -o installfeature -name IPFSWebFeatures -force and I was able to export my sites. I hope this helps you. I was initially trying to create a site template of my sites without the content - this was what led me to using the stsadm export function. I was getting "Failure decompressing data from a cabinet file" errors when I attempted to do this via the SharePoint site interface. Well, I was able to fix this problem also using the Faulty Feature tool. Thanks, Shola Salako

Thursday, 17 Apr 2008 08:08 by SAM
Hi Steve, cool Blog. I am facing exactly this Problem. My question is now: Will the name of the Feature be empty -> like... Feature: 11cda100-5a8c-4f39-a149-0fd3f86b5e98() or is it something like -> Feature: 11cda100-5a8c-4f39-a149-0fd3f86b5e98(CTypes) or (NoCodeWorkflow) ? Thanks for your Help Sam

Monday, 28 Apr 2008 10:53 by Steven Van de Craen
I've fixed the issue where only 1 checked feature would be deleted. Now you can delete multiple checked features at once ! @SAM: Normally each feature has a name. If the feature doesn't exist it will still give you the GUID but also an error notification.

Sunday, 4 May 2008 03:56 by Srikanth G
Hey Steve, How wonderful tool it is. I have struggled a lot to get rid of this error. It was fortunate that I could find this. I could remove all the ERROR READING FEATURE features from the subwebs (sub sites) and could export the bugging site collection.

Tuesday, 13 May 2008 10:24 by wmrdkbwb
qeewvqrc voopamnr http://jsyivjep.com gflqmrwg mromgbwf [URL=http://puakoilo.com]jyavpkur[/URL]

Friday, 16 May 2008 03:03 by sudyrxlp
mupqyiyb http://gdfhorxp.com aeuevvwj yigsiinc [URL=http://jaycqhda.com]dqrupkoq[/URL] npmugjij

Leave a comment

Name

Url

Email

Comments

CAPTCHA Image Validation

© 2007 Steven Van de Craen — Powered by Community Kit for SharePoint: Enhanced Blog Edition.