4

When I open Visual Studio and attempt to connect to TFS, I get the following error message:

Error

Unexpected end of file.

error - unexpected end of file

I've found a handful of places online (like here and here) where people have run into similar situations but clearing the Team Foundation cache as recommended doesn't solve the issue.

I even completely uninstalled Visual Studio Enterprise 2015 and installed Visual Studio Enterprise 2017 and still get the same error.

I recently created a new TFS instance on another server for testing out some automated build features without messing with our current setup and can connect to the new TFS instance just fine.

What would cause this error?

Community
  • 1
  • 1
TheIronCheek
  • 1,077
  • 2
  • 20
  • 50

3 Answers3

7

First you could use another machine with VS installed to connect the same TFS under your account. This will narrow down if the issue only occurs on your local machine or not.

You could try to clear both TFS and VS cache issue.(You may not uninstalled the previous VS clearly).

For TFS cache:

  • close all instances of Visual Studio on the client machine,
  • manually delete the corresponding Tfs client cache folder, and then
  • start Visual Studio

    The corresponding Tfs folders to manually delete are as follows:

       Tfs 2017: "%localappdata%\Microsoft\Team Foundation\7.0\Cache\"
    
       Tfs 2015: "%localappdata%\Microsoft\Team Foundation\6.0\Cache\"
    

For VS cache:

Delete the contents from the following folders

C:\Users\<<Your Alias>>\AppData\Local\Microsoft\VisualStudio
C:\Users\<<Your Alias>>\AppData\Local\Microsoft\VSCommon

Moreover, also give a try with removing the tfs related credentials from Credential Manager, close all Visual Studio instances, deleting %LOCALAPPDATA%\.IdentityService, use another user account connect to the TFS server.


Update: Op ended up doing an OS reload and haven't had any issues since.

PatrickLu-MSFT
  • 49,478
  • 5
  • 35
  • 62
  • Deleting the VS cache was a great idea I hadn't thought of but it still didn't solve it. If another AD user logs into my computer, they can connect just fine. Also, if I log into another computer, I can connect just fine. That means it has to be related to my profile on my computer, right? There's got to be some cache files located somewhere that I haven't blown away yet... – TheIronCheek Jan 05 '18 at 13:55
  • @TheIronCheek Yes, seems to be some stored TFS credentials in your machine which broke the connection. To clear stored TFS credentials in Visual Studio 2017, you could first remove the tfs related credentials from **Credential Manager** in control pane, then close all Visual Studio instances, delete `%LOCALAPPDATA%\.IdentityService`. Also clear all the browser caches. More ways please refer this related question in SO: https://stackoverflow.com/questions/47188210/clear-stored-tfs-credentials-in-visual-studio-2017 – PatrickLu-MSFT Jan 05 '18 at 14:15
  • 1
    There were no tfs-related credentials in the Credential Manager and .IdentityService didn't exist either. I think I'm just going to reload the machine. I'm supposed to upgrade to Windows 10 soon anyway. – TheIronCheek Jan 05 '18 at 14:41
  • @TheIronCheek That's weird. VS2015 usually stored the credentials in the Credential Manager and VS2017 stored them in the `%LOCALAPPDATA%\.IdentityService`. Have you tried restart your computer? Even tough reinstall the entire machine may not be a real solution, but the issue should definitely be solved. Any update, you could share here. – PatrickLu-MSFT Jan 05 '18 at 15:16
  • I did many restarts throughout the process. I agree, I found the whole ordeal really strange. I ended up doing an OS reload and haven't had any issues since. – TheIronCheek Jan 08 '18 at 21:35
  • @TheIronCheek About this issue, how's going? Did the OS reload prevent this to happen again? If it did, seems to be client side issue, not TFS server side. – PatrickLu-MSFT Jan 22 '18 at 02:35
  • 1
    Yes, the OS reload solved the problem. I'm convinced there was a file cached somewhere that I just couldn't locate. The full reload was likely overkill but I needed to move to Windows 10 anyway. – TheIronCheek Jan 23 '18 at 14:28
  • @TheIronCheek Glad to hear this, thanks for the sharing, you could add a reply with the solution then mark it or mark my reply as an answer directly, which will also helps others in the community if they encountered the same issue in the feature. – PatrickLu-MSFT Jan 23 '18 at 14:53
0

I ended up doing a full OS reload

It was likely overkill as I'm convinced there was a cached file somewhere I couldn't locate that was holding those settings but I didn't have the extra time to fiddle with it and I needed to move to Windows 10 at some point anyway.

I'd venture to guess @PatrickLu-MSFT's answer will work for most people but for whatever reason it didn't for me.

TheIronCheek
  • 1,077
  • 2
  • 20
  • 50
0

In my case I closed Visual Studio 2017, went to the solution's directory and deleted the .vssscc file.

The file was then regenerated and the problem was solved.

Nelssen
  • 1,023
  • 1
  • 17
  • 42