puzzle-issue-problem-128-link.png

When you try to detach a Team Project Collection in Team Foundation Server the process fails on SnapshotIdentities with an “object reference not set to an instance of an object” error. While this does not inhibit the execution of TFS there is likely a good reason that you wanted to detach and found this issue.

image13
Figure: object reference not set to an instance of an object

In this case I was trying to move the Collection to another server and this is a blocking issue.

Applies To

  • Team Foundation Server 2012
  • Team Foundation Server 2012.1
  • Team Foundation Server 2012.2
  • Team Foundation Server 2012.3
  • Team Foundation Server 2013 Preview

Findings

When you get these sorts of errors make sure that you look in the Event Log of the server and at the logs generated by TFS. In the event of an error there will be a link on the page that will open the relevant log in the Team Foundation Server Administration Console.

In the log you can clearly see that the step that is failing is the “Snapshot.TfsIdentities”. What I believe that this does is create a package inside of the Collection database for the new TFS Instance that you are moving it to. This package needs to contain all of the Identities that have interacted with this TFS Instance. The likely cause of this error is that there are orphaned group memberships in the Configuration database that do not exist within the Collection.

I would suggest that this would be the result of a TFS server that has backed up without the use of a ‘marked transaction log’ and that backup restored at some point. If you have large databases and you don’t use the built in Scheduled Backups tool or the documented process to manually back up Team Foundation Server then you are leaving yourself open for this type of inconsistency.

To find out if your have any orphaned identities then you should run:

Warning Do not make any changes to any of your TFS Databases manually unless specifically instructed by the Product Team. If you do then you can no longer be supported by Microsoft.

If you get results from this query then you have this problem and you should immediately raise a support ticket with Microsoft to get this fixed.

Solution

You need to remove all of the orphaned identities from your server in order to fix this. To achieve that you should work with Microsoft by raising a support ticket and cleaning the instance.  If an invalid backup has been restored there are likely other things that need to happen to get into a supported state and changing the database yourself will not get you there.

Raise a ticket and get your server into a supported state…

    Issue [ TFS 2012.2 ] Detaching collection fails on SnapshotIdentities with object reference not set to an instance of an object was last modified: June 24th, 2013 by Martin Hinshelwood

    -Every company deserves working software that successfully and consistently meets their customers needs on a regular cadence. We can help you get working software with continuous feedback so that your lean-agile teams can deliver continuous value with Visual Studio ALM, Team Foundation Server & Scrum. We have experts on hand to help improve your process and deliver more value at higher quality.

    Tagged with →