Where is my code gone!!!

One of the most common issues that i hear from customers is ...unable to check-in the code or when they do the Getlatest the code seems to be lost.

To keep track of what code has made to the server we need to trace the communication between the client and server. We can do this by using the following

 1) TFS Client tracing

You can enable the tracing using the steps mentioned here https://blogs.msdn.com/edhintz/archive/2007/03/30/tfs-client-tracing.aspx

Note: this has to be done on the client where we see the issue. Sometimes when we enable the logging the client, you are no more able to connect to the server and get one of the errors .

TF30331: Team Explorer could not connect to the Team Foundation server servername used during your last session. The server may be offline or the network is unavailable.

Contact your Team Foundation Server administrator to confirm that the server is available on the network. Use the Connect to Team Foundation Server command on the Tools menu to reconnect to your previous server.

The server returned the following error: Index and length must refer to a location within the string.
Parameter name: length 

This happens especially for Windows Vista clients. To fix the issue, you need to install the fix mentioned here https://support.microsoft.com/kb/936210. You can get it from https://connect.microsoft.com/VisualStudio/content/content.aspx?ContentID=3705 or raise a free ticket with microsoft support( https://support.microsoft.com)

Once you enable tracing, all the communication between the client and server is logged and you can look into the log file avaialble

 (say c:\tfs-tracefile.log) and trace the issue

2) TFSActivitylogging database 

Team Foundation Server has a feature to log every server "command" (a command is a TFS web service call) to a database on the data tier.

To learn more, visit the excellent article by Brian, https://blogs.msdn.com/bharry/archive/2005/10/24/484125.aspx

This two things should help us trace any code loss issues and also see what is going on between clients and server.

Lot of times the culprit is Anti-Virus which is interfering with the communication, beware of this :)