How to solve “Error HRESULT E_FAIL has been returned from a call to a COM component” popping up in Team System Web Access (TSWA)

This week I came across a problem with TSWA where error COMException E_FAIL pops up while creating new work items.

image

The call stack of the error shows up in the event log of the TFS App Tier (where TFS is installed to).

UserControl: [Error, P 6844, T 4744/8, A 12775551, S 0, 1/9/12 12:19:44.562] Ausnahme: {
Exception Message: Beim Aufruf einer COM-Komponente wurde ein HRESULT E_FAIL-Fehler zurückgegeben. (type COMException)

Exception Stack Trace: bei System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
bei Microsoft.TeamFoundation.WorkItemTracking.Client.DataStore.MetadataProvider.get_ConstLookupName()
bei Microsoft.TeamFoundation.WorkItemTracking.Client.DataStore.MetadataProvider.FindConstant(String name, Int32& id)
bei Microsoft.TeamFoundation.WorkItemTracking.Client.Provision.WitExporter.get_GlobalLists()
bei Microsoft.TeamFoundation.WorkItemTracking.Client.Provision.WitExporter.ExportGlobalLists(XmlElement root)
bei Microsoft.TeamFoundation.WorkItemTracking.Client.Provision.WitExporter.ExportWorkItemType(Int32 lTreeId, Int32 lTypeId, ExportMask flags)
bei Microsoft.TeamFoundation.WorkItemTracking.Client.Provision.ProvisionClass.ExportWorkItemType(Int32 projectId, Int32 typeId, Boolean withGlobalListsFlag)
bei Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemType.Export(Boolean includeGlobalListsFlag)
bei Microsoft.TeamFoundation.WebAccess.WorkItemTracking.WorkFlow.WorkItemWorkFlow.GetWorkflow(ITfsConnection tfsConnection, WorkItemType workItemType, Boolean includeGlobalListsFlag)
bei Microsoft.TeamFoundation.WebAccess.WorkItemTracking.Controls.WorkItemEditorState.Initialize()
bei Microsoft.TeamFoundation.WebAccess.UI.Controls.EditWorkItem.GetEditorState(NameValueCollection requestParams)
bei Microsoft.TeamFoundation.WebAccess.UI.Controls.EditWorkItem.RenderUserControl()
bei Microsoft.TeamFoundation.WebAccess.UI.WebAccessUserControl.OnLoad(EventArgs e)

}

The classes Microsoft.TeamFoundation.WorkItemTracking.Client.DataStore.MetadataProvider main purpose in that scenario is to cache some meta data regarding work items and global lists.

If the cached data does not fully correspond to the appropriate database values (because some rows in the Constants table were deleted manually for instance) than the error occurs.

In order to fix it, the TSWA cache needs to be deleted and the TSWA’s IIS App Pool needs a restart.

Today I learned from my colleague Nitish that there is another problem with the same symptom where the root cause is in the SQL DB.

Please refer to his post just in case the instructions above did not solve the problem:

https://blogs.msdn.com/b/dstfs/archive/2012/04/26/quot-error-hresult-e-fail-has-been-returned-from-a-call-to-a-com-component-quot-using-tfs201-team-web-access.aspx

 

 

Good Luck!