问题
I'm trying to check in a file, and one file (one and only one file) has a problem while being checked in. This file has been deleted many times and undeleted (due to a conflict in architecture and design) and now TFS throws this error:
TF246021: An error occurred while processing your request. Technical information (for administrator): SQL Server Error: 500200
As we saw the log file of the Event Viewer, the problem is:
Violation of PRIMARY KEY constraint 'PK_tbl_PendingDelta'. Cannot insert duplicate key in object 'dbo.tbl_PendingDelta'.
However, there is no pending changes in dbo.tbl_PendingDelta. In fact, this table is completely empty. What's wrong here? How can I solve this problem?
回答1:
This seems to be related to the workspace. I had this problem on one workspace but was able to perform the source control operation that triggered the error (rollback a previous rollback) in a different workspace without any problems.
Recreating your workspace might be a solution.
回答2:
My solution was to exclude the culprit and check in the rest.
I then checked in the culprit.
( If you have a gated checkin you might have to turn that off first. )
回答3:
I suspect that somehow the items in the change set use the same ID twice, so the first INSERT is fine but the second will cause the violation. However, since they're in the same transaction, the first INSERT is rolled back and you don't see anything in tbl_PendingDelta afterwards.
See http://connect.microsoft.com/VisualStudio/feedback/details/693450/tfs-2010-violation-of-primary-key-constraint-pk-tbl-pendingdelta for another example of this issue.
I think you should take this up with Microsoft Product Support Services.
回答4:
I had something similar happen. Previously I had rolled back some changes and was reintroducing those changes in the solution and project files again with the same name. The problem that I found was a sql script rename was not in the Sql.proj file and I needed to add it and then close the solution to accept the changes to the proj file. Once I corrected the rename, made sure that it was in the project file, then I could check it in.
回答5:
I renamed my workspace folder (the top level containing $tf) then did a get latest on the branch I wanted, then the unshelve worked.
来源:https://stackoverflow.com/questions/14746267/how-to-solve-tfs-error-tf246021-and-sql-server-error-500200-while-checking-in