I’ve posted this more as a reminder to myself next time I create TFSJobAgent plugins.
If you ever encounter the error below when adding a new TFSJobAgent plugin:
TF53010: The following error has occurred in a Team Foundation component or extension:
Date (UTC): 2/25/2013 2:04:52 PM
Application Domain: TfsJobAgent.exe
Assembly: Microsoft.TeamFoundation.Framework.Server, Version=18.104.22.168, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a; v4.0.30319
Process Name: TFSJobAgent
Process Id: 8996
Thread Id: 6656
Account name: NT AUTHORITY\LOCAL SERVICE
Detailed Message: There was an error during job agent execution. The operation will be retried. Similar errors in the next five minutes may not be logged.
Exception Message: An item with the same key has already been added. (type ArgumentException)
Exception Stack Trace: at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at Microsoft.TeamFoundation.Framework.Server.TeamFoundationExtensionUtility.LoadExtensionTypeMap[T](String pluginDirectory)
at Microsoft.TeamFoundation.Framework.Server.JobServiceUtil.RetryOperationsUntilSuccessful(RetryOperations operations, Int32& delayOnExceptionSeconds)
The above error was caused by me having more than one copy of my component in the plugins folder
C:\Program Files\Microsoft Team Foundation Server 11.0\Application Tier\TFSJobAgent\plugins
You’re probably wondering how this is possible? I actually had another folder in the plugins folder with a copy of my component. The TFSJobAgent uses reflection to find all components that implement the ITeamFoundationJobExtension interface at runtime this includes all subfolders under the plugins directory.