Wednesday, April 25, 2007

Error: "An item with the same key has already been added." When modifying the search results web part's XSLT

When you modify the xslt in the people core results web part, you may get the following error (I get it everytime) when you click "OK" in the web part settings:
System.ArgumentException: An item with the same key has already been added. 
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) 
at Microsoft.Office.Server.Search.WebControls.PeopleCoreResultsWebPart.SetSortedRefinementDataOnHiddenObject() 
at Microsoft.Office.Server.Search.WebControls.PeopleCoreResultsWebPart.GetXPathNavigator(String viewPath)
This is very annoying and I do not know how to solve it. But if you get it, don't worry - your change has been made, and you just need to check-in\publish the page to see the effect. The problem ofcourse is that you may not want to check-in the page without seeing the result first, and there is no way around this...


Anonymous said...


Thanks heaps... you saved me from a depressing / confusing morning.

I ignore the error and my XSL changes work , just as u said.

Mike D

Amandeep said...

Hello Ishai,
I want to learn basics of Share Point Search. How to enhance it, customize it and anything related to Share Point Search. Can you please recommend or pass me some links.