Teamcity can't connect to TFS after disk being filled up on machine

Yesterday the disk on our machine got completely full and this was solved by removing some folders in the Teamcity/temp directory.

Now our build fails because it won't connect to TFS:

TFS failed. ExitCode: 1, Stdout:: TFS Native Verifier v6.0 Copyright (C) 2006-2011 JetBrains s.r.o.
INFO  - Use Tfs from JetBrains.TeamCity.Tfs.Tfs10Accessor
TFS Native Accessor v6.0 Copyright (C) 2006-2011 JetBrains s.r.o.
INFO  - Connecting to server http://littfs01:8080/tfs/DefaultCollection
Connection test:
  Server='http://littfs01:8080/tfs/DefaultCollection'
  Username='Tfsservice'
  Root='$/Litium.Framework/Dev'
ERROR - The cache file C:\Windows\system32\config\systemprofile\AppData\Local\Microsoft\Team Foundation\3.0\Cache\VersionControl.config is not valid and cannot be loaded.
Please correct or delete the file.

System.Exception: The cache file C:\Windows\system32\config\systemprofile\AppData\Local\Microsoft\Team Foundation\3.0\Cache\VersionControl.config is not valid and cannot be loaded.
Please correct or delete the file.
---> Microsoft.TeamFoundation.VersionControl.Client.VersionControlException: The cache file C:\Windows\system32\config\systemprofile\AppData\Local\Microsoft\Team Foundation\3.0\Cache\VersionControl.config is not valid and cannot be loaded.
Please correct or delete the file.
---> System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.TeamFoundation.VersionControl.Client.InternalCacheLoader.LoadConfig(InternalCache currentCache, Boolean dataDirectoryExists, InternalWorkspaceConflictInfo[]& conflictingWorkspaces)
   --- End of inner exception stack trace ---
   at Microsoft.TeamFoundation.VersionControl.Client.InternalCacheLoader.LoadConfig(InternalCache currentCache, Boolean dataDirectoryExists, InternalWorkspaceConflictInfo[]& conflictingWorkspaces)
   at Microsoft.TeamFoundation.VersionControl.Client.Workstation..ctor(WorkstationType type)
   at Microsoft.TeamFoundation.VersionControl.Client.Workstation.get_Current()
   at Microsoft.TeamFoundation.VersionControl.Client.Workstation.VersionControlServerList.Add(VersionControlServer sourceControl)
   at Microsoft.TeamFoundation.VersionControl.Client.Client..ctor(VersionControlServer sourceControl)
   at Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer.Microsoft.TeamFoundation.Client.ITfsTeamProjectCollectionObject.Initialize(TfsTeamProjectCollection tfs)
   at Microsoft.TeamFoundation.Client.TfsTeamProjectCollection.InitializeTeamFoundationObject(String fullName, Object instance)
   at Microsoft.TeamFoundation.Client.TfsConnection.CreateServiceInstance(Assembly assembly, String fullName)
   at Microsoft.TeamFoundation.Client.TfsConnection.GetServiceInstance(Type serviceType, Object serviceInstance)
   at Microsoft.TeamFoundation.Client.TfsTeamProjectCollection.GetServiceInstance(Type serviceType, Object serviceInstance)
   at Microsoft.TeamFoundation.Client.TfsConnection.GetService(Type serviceType)
   at Microsoft.TeamFoundation.Client.TeamFoundationServer.GetService(Type serviceType)
   at JetBrains.TeamCity.Tfs.Command.Do() in c:\Agent\work\9f2b3673cc66b89\TfsNativeAccessor\src\Command.cs:line 26
   at JetBrains.TeamCity.Tfs.Program.Main(String[] args) in c:\Agent\work\9f2b3673cc66b89\TfsNativeAccessor\src\Program.cs:line 110
   --- End of inner exception stack trace ---
   at JetBrains.TeamCity.Tfs.Program.Main(String[] args) in c:\Agent\work\9f2b3673cc66b89\TfsNativeAccessor\src\Program.cs:line 349
, Stderr::

I can't find the VersionControl.config file at the place specified. I found it at some other places, and removed them, but no luck there...

What can I do to fix this?

7 comments
Comment actions Permalink

Hi

Sorry for late response.
The issue with TFS-related data left in TEMP folder was wixed in version 6.0.2 (TW-15026)
To fix TFS configuration you need to interactivelly logon to account used by TeamCity agent, open Team Explorer, and connect to the project.

Michael

0
Comment actions Permalink

We are still experiencing exactly the same problem as mentioned above (ERROR - The cache file C:\Windows\system32\config\systemprofile\AppData\Local\Microsoft\Team Foundation\3.0\Cache\VersionControl.config is not valid and cannot be loaded.
Please correct or delete the file.) which also started ocurring after we ran out of disk space. The file it mentions does not exist: indeed there are no files in the Cache directory

I have tried manually starting Visual Studio and connecting to TFS while logged in as the user that the Agent service is running as, as well as compltely uninstallting Teamcity and reinstalling version 6.5, both to no avail. I also tried deleting and recreating the tfs folder under plugins as you suggested in the linked bug report, but I am still getting exactly the same error.

Do you have any other suggestions?

Many thanks,

-Tristan.

0
Comment actions Permalink

Is the build agent service started under LocalSystem or some user account?

0
Comment actions Permalink

I tried both. It was Local System, but then I switched to a user account, and then used that user account to log in manually, start up Visual Studio and connect to TFS using Team Explorer. Do I need to do something else?

0
Comment actions Permalink

TFS internal state seems to be corrupted. Please do the following:
- stop TeamCity
- remove TFS cache as was recommended in the error message
- check TeamCity windows service is running under same user account, not System account
- make sure tf.exe is able to work with TFS. (for example try tf.exe history command. Check tf.exe help for more details)
- check if TFS accessing user account password is not expired.
- start TeamCity and check if it is workable now

0
Comment actions Permalink

Hooray, that fixed it.

Thanks for your help, Eugene.

0

Please sign in to leave a comment.