Share via


Orphaned locks in TFS

We recently found a bug which exists in TFS 2005, 2008 and 2010 where a certain set of user actions can cause you to end up with orphaned locks in a workspace. The error message you get when you try to checkout is:

The item $/proj/xyz is locked for check-out by (null) in workspace (null).

We will be fixing this bug in the next available opportunity, but until then you can use the following script to clear the locks if you hit this problem.

SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
DELETE l
FROM  tbl_Lock l
LEFT JOIN tbl_PendingChange pc
ON l.PendingChangeId = pc.PendingChangeId
WHERE pc.PendingChangeId IS NULL

Sorry for the incovenience,

Chandru