JavaScript Errors in SharePoint Application Pages

Today was a day packed with investigation and troubleshooting weird JavaScript errors on a customer premise. I put this information on my blog so to help anyone who might have found in a similar journey.


Problem 1: Views

You have a custom SharePoint 2010 master page. You assign that master page as the master page for a site, both for content and system pages. You face the following errors when dealing with list or library views:

  • You can’t change the current view in the Ribbon view selector. The combo box doesn’t drop down. Additionally, you do not have the view selector on the page title.
  • You edit the current view (or any other view). A JavaScript error is displayed in Internet Explorer and you can’t save the changes. However, in Firefox you can modify the view without any problems.
Problem 2: File Upload page

You have a custom SharePoint 2010 application page. The page inherits from the default SharePoint file upload page. You want to replace the file upload control with a custom control. However, you have to maintain the original control because the inherited code relies on the presence of those controls. You hide the controls but you still face JavaScript errors due to the hidden control validation scripts.


Problem 1: the culprits are the new SharePoint 2010 master page placeholders and delegate controls.

In order to have view selector working, you have to add the following DelegateControl to the master page (as found on this thread):

<SharePoint:DelegateControl runat="server" ControlId="TreeViewAndDataSource">

The weird JavaScript errors on the Edit View page were caused by a PlaceHolderUtilityContent that was misplaced. This content placeholder should be placed outside the <form> tag on the master page, as this MSDN article outlines.

<asp:ContentPlaceHolder id="PlaceHolderUtilityContent" runat="server"/>

It seems that the Internet Explorer breaks when a JavaScript error is found, and skips the execution of the remaining script block while Firefox just skips the current line and executes the remaining lines if they are correct. The errors were about the objects being null, as the IE skipped the object initialization commands due to the errors generated by a misplaced placeholder tag.

Problem 2: the culprit was the JavaScript emitted by the default validation controls for the file upload selector. The solution was to embed the default control inside an ASP.NET Panel control set to Visible="false". In this way the controls are present on the server but nothing is rendered back to the page, preventing JavaScript errors.

Reconfigure A Rogue SharePoint 2010 Search Service

Hello again to all the readers of my blog. I haven’t been around lately, but I have a good excuse for that: I was getting married. Now, as the feasts are over, I’ll be back in business as usual.

Today I’ve stumped across a puzzling problem with an existing SharePoint 2010 installation. The problem was that the Search Service Application was misbehaving, giving weird errors of not being able to connect to itself.

After some extensive googling, this forum post led to a clue: remove the service application altogether and rebuild it again from scratch. The command to remove the service application is done in the old reliable STSADM:

stsadm.exe –o deleteconfigurationobject –id <GUID_of_the_service_application>

That did the trick! After that, make a new search service application in Central Administration and you are good to go.

Note: the same forum post mentioned another post, which has a script to remove the service applications, for the PowerShell-savvy among you.

SharePoint Configuration Database IP Address Blues

A really weird situation happened yesterday at work.

The Symptoms

We wanted to move the Virtual Machine that serves as a SQL Server for our development SharePoint environment, from one host computer to another host computer. No renaming, no changes…it should have been really transparent to SharePoint.

Well, it wasn’t.


Once we moved and restarted the server, the SharePoint refused to work. We were starting to dig within the log files and we found out that the front-end was trying to contact a fixed IP address as a SQL Server. This was the old IP address of the database server virtual machine before it was moved. We scanned the Registry for references to this IP address but none was found.

We even made a brand-new virtual machine with SharePoint 2007 and tried to connect it to the SQL Server. It did, but the dreaded error connecting the old IP address persisted. So, we deduced that the culprit IP was stored somewhere in SharePoint databases.

The Workaround

The solution to this problem was simple, once we found out what it was. The network card on the database server was set to multicast IP with the old IP address as a “second identity” for the card. In this way, SharePoint could connect itself to the databases using the bad IP address.

Once we got into Central Administration, we removed the server that showed as bad IP address in Server Topology page. Furthermore, we did a STSADM –o renameserver to change the references from the old IP-address name to fully-qualified domain name of the server. Bravely, we removed the alternate IP from the database server NIC card settings and did an IISRESET on the SharePoint side.

Worked as a charm. Two days lost fixing this, though 🙁

The Learning

In this case, cut the right hand of the SharePoint administrator who first added the reference to the database server by IP address alone. (Just kidding, of course).

IE8 Developer Tools Not Working?

I’ve been pulling my (scarce) hair when suddenly the Developer Tools in IE8 didn’t appear as expected, on one day. The taskbar in Windows showed the tools’ window but there were none to be seen.

Luckily, a quick Google search unshoveled this StackOverflow question. The reason was that the tools were off-screen.

It was just a matter of right-clicking the taskbar tools’ window, choosing “Maximize” and pin the tools back to the main IE8 screen.

Hunt For BSOD in Windows 7 x64

I have a shiny new Windows 7 Ultimate 64-bit edition installed on my Dell laptop but in the last month I’ve been suffering intermittent BSOD errors (the infamous Windows’ Blue Screens of Death). They just seem to happen randomly every few days.

First I tried the Windows online solution check included in Windows 7, but found nothing.

Then I downloaded a free tool called WhoCrashed. It showed me that the error was inside the standard Windows NTOSKRNL.EXE module.


I was not satisfied with the answer. I downloaded the WinDBG tool (necessary to run WhoCrashed), I downloaded the Debug Symbols from Microsoft (by setting up the tool correctly, as explained in this page from Microsoft).

I opened a crash dump file generated by Windows in Minidump folder.


I run a deep analysis with !analyze –v option


And I found the culprit: the ShrewSoft VPN Client I had installed a month ago! It seems that the last stable version has issues with Windows 7 x64 and sometimes causes BSOD. I’ve downloaded the latest beta of the client and the problem seems gone.

I installed the ShrewSoft VPN client because it’s free and it works (well, mainly) with Windows 7 in 64-bit mode, unlike Cisco VPN client that does not. There is an alternative client from NCP, but it costs about 120 EUR.

“Failed to compare two elements in the array” Error During SPExport.Run

I’ve made a custom SPExport and SPImport tool that duplicates site content around the SharePoint site collection. However, it would suddenly run with no visible effects (no content was copied). After digging around the ULS logs (using the excellent log library provided by Ayman el-Hattab) I found out that SharePoint SPExport.Run() method was throwing a strange exception:

Failed to compare two elements in the array. at System.Collections.Generic.ArraySortHelper1.QuickSort[TValue](T[] keys, TValue[] values, Int32 left, Int32 right, IComparer1 comparer) at System.Collections.Generic.ArraySortHelper1.Sort[TValue](T[] keys, TValue[] values, Int32 index, Int32 length, IComparer1 comparer) at System.Collections.Generic.ArraySortHelper1.Sort(T[] items, Int32 index, Int32 length, IComparer1 comparer) at System.Array.Sort[T](T[] array, Int32 index, Int32 length, IComparer1 comparer) at System.Collections.Generic.List1.Sort(Int32 index, Int32 count, IComparer1 comparer) at System.Collections.Generic.List1.Sort(IComparer1 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: Failed to find the XML file at location '12TemplateFeaturesMyFeaturefeature.xml' at Microsoft.SharePoint.SPXmlDocCache.GetGlobalXmlDocumentCore(String pathXml, Boolean bFeature) at Microsoft.SharePoint.SPXmlDocCache.GetGlobalXmlDocument(String pathAllFeaturesRelativeXml) at Microsoft.SharePoint.Administration.SPFeatureDefinition.EnsureGlobalDefinition() at Microsoft.SharePoint.Administration.SPFeatureDefinition.get_Scope() at Microsoft.SharePoint.Administration.SPFeatureDefinition.ActivationDependencyComparer.System.Collections.Generic.IComparer<Microsoft.SharePoint.Administration.SPFeatureDefinition>.Compare(SPFeatureDefinition featdef1, SPFeatureDefinition featdef2) at Microsoft.SharePoint.Deployment.WebSerializer.ExportFeatureComparer.System.Collections.Generic.IComparer<Microsoft.SharePoint.Deployment.ExportObject>.Compare(ExportObject exportObject1, ExportObject exportObject2) at System.Collections.Generic.ArraySortHelper1.QuickSort[TValue](T[] keys, TValue[] values, Int32 left, Int32 right, IComparer`1 comparer)

As you can see (the bolded text above), the real culprit was an orphaned feature that was present on the source site but it’s physical components were not present on the 12/TEMPLATE/FEATURES folder. After the feature redeployment and reactivation, the export job was ready to go.

MOSS Shared Services Provider Administration Job Error (Event ID 6482)



The Event Log shows the following error entry for Office Server Shared Services with Event ID 6482, every couple of minutes:

Application Server Administration job failed for service instance Microsoft.Office.Server.Search.Administration.SearchServiceInstance (edc207f7-5d7e-44cc-b65a-2326be88ffca).
Reason: No mapping between account names and security IDs was done. (Exception from HRESULT: 0x80070534)

Additionally, when you click the “View Properties” menu entry of the SSP in Central Administration / Shared Services in this Farm, an error page appers with the following error:

An unhandled exception occurred in the user interface.Exception Information: The specified account name is invalid.
Parameter name: account


The SSP adds the application pool account to the “View Properties” page of the SSP. If this application pool is later changed and the original account is removed from Active Directory, the page crashes because it can’t map the username to the actual user (as there is none to be found). Additionally, there’s a timer job in SSP that refreshes the configuration and it also fails due to the same error.


  • Set the detailed SharePoint logs in Central Administration, by setting Verbose level for the “Office Server General” category
  • In the logs, check the user that SSP is trying to find
  • Recreate that user temporarily in Active Directory (with no special privileges)
  • Go to the SSP Properties page in Central Administration and remove that user from the last list box in the properties page (“Process Accounts”)
  • Remove that user from the Active Directory

Team Foundation Client Error in VS2008

A weird thing happened to me yesterday when I was trying to edit a couple of work items in Team Foundation client from Visual Studio 2008.

Could not load type ‘Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemTypeDeniedOrNotExistException’ from assembly ‘Microsoft.TeamFoundation.WorkItemTracking.Client, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’.

The cause

I’ve installed the Team Explorer AFTER patching the VS2008 to SP1. Reinstalling the VS2008 SP1 again solved the issue by patching the Team Foundation client binaries, too.

SharePoint Navigation Doesn’t Show a Subsite for Users with Custom Permission Level

Interesting behaviour that I saw yesterday.

I had a MOSS 2007 site with a custom permission level defined on it. The users that had this permission level didn’t see the site on the top navigation bar, but if they entered the site by the URL they could enter it without troubles.

The solution was to add a “View Elements” permission to the custom permission, too. After that the site showed correctly on the top navigation bar.

Deploying a Solution in a Farm Fails Because of OWSTIMER.EXE

Today I had a strange error happening trying to deploy a WSP package on a SharePoint farm that had 2 front-end servers. On my local development virtual machine it deployed and activated flawlessly, but on the farm it deployed itself only to the local server and not the other server, stating that the deployment failed.


It also gave the following misleading log entry in SharePoint logs:

OWSTIMER.EXE (0x065C)       Windows SharePoint Services       Timer

The Execute method of job definition "SPSolutionDeploymentJobDefinition" (id "0943ea83-88d3-4eae-b2d0-21ffca1c66ec") threw an exception. The method or operation is not implemented.

I double-checked the class name, the receiver assembly name. I removed all traces of the package (FEATURE files, DLL in the GAC), I did countless IISRESETs…in vain. The error repeated itself back and back again.


I had a moment of inspiration and I restarted the WSS Timer Service on both front-end servers. I tried to deploy the solution again. It worked perfectly this time!

Five hours lost to a deadlocked OWSTIMER.EXE thread 🙁