TFS Error - Unexpected End of File - visual-studio

When I open Visual Studio and attempt to connect to TFS, I get the following error message:
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?

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.

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.

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.

Related

Where do I find Visual Studio Team explorer error details?

When I open the Pending Changes tab in Visual Studio Team Explorer, it says that "One or more errors occurred." Where can I find details on what kind(s) of error have occurred?
Some background: We have recently upgraded our source code repository from TFS 2010 to Azure DevOps Server 2020 (with TFS 2015 as a required intermediate step), in the process moving from one server to another. After switching the URL in Visual Studio, developers started getting this error message. Apart from that, everything seems to be working fine. Pending changes are displayed, check-in/check-out works.
There is no such related logs stored in TFS/Azure DevOps side.
For TFS/Azure DevOps, the installation log file generally store in temp folder.
Typically this folder is : C:\Users\{name}\AppData\Local\Temp
And the Configuration logs stored in:
C:\ProgramData\Microsoft\Team Foundation\Server Configuration\Logs
The logs should be stored accordingly in case of TFS version upgrade.
In your situation, sometimes if you are working with multiple TFS account /TFS version in the same system then TFS caches something and throws the error . So, for this you can clear the TFS cache and check if this work.
You can clear TFS’s cache from following location:
C:\Users\UserName\AppData\Local\Microsoft\Team Foundation\x.0\Cache
Once cache will delete, probably TFS will ask for credential to reconnect. You need to provide valid credentials.
If you still get similar errors after above steps, I would suggest you also clear Visual Studio cache, which may do the trick.
I closed the visual studio and reopened and it got fixed.

Visual Studio Encounters 403 Error Connecting to DevOps Project

One of my developers is receiving the following message from Visual Studio 2017 Enterprise when trying to connect to one of our DevOps projects and we've tried everything we can think of and everything we've found from searching Stack Overflow and the internet in general just hasn't worked.
Here's the error from Visual Studio:
We could not add the account
The browser based authentication dialog failed to complete. Reason:
The server understood the request, but is refusing to fulfill it.
What we've tried
Deleting the folders Team Foundation, VisualStudio, VisualStudio Services, VSCommon, and vshub located in %userprofile%\AppData\Local\Microsoft
Deleting everything from Windows Credential Manager.
Authenticating via browser (success).
Repository is hosted on dev.azure.com.
From what I understand, this is an HTTP 403 error which means the user successfully authenticated and that they just don't have permissions to view the requested resource. Permissions in DevOps are identical to other users that don't have any issues. We have 1 group for the developers and if you're in that group, you have all necessary permissions so I'm confident their permissions are identical to the other devs that aren't having any issues.
I think I understand what this error means for websites in general, however I seem to be at a loss for what either Visual Studio or Azure DevOps wants us to do specifically to alleviate this error.
The browser based authentication dialog failed to complete.
Once it was a known issue in old VS2015 and VS2017, but I can't reproduce it on my latest VS2017 15.9.23. Here're some tips you can follow to resolve that issue:
1.Update VS2017 to latest 15.9.23 version.
2.Navigate to VS installation path C:\Program Files (x86)\Microsoft Visual Studio\2017\VsEdition\Common7\IDE and run devenv.exe /resetsettings and devenv.exe /resetuserdata to reset the VS settings and userdata. From Joyce Lin.
3.Check your registry settings and empty the China endpoint if it exists. Check this one. Now try to log in the VS...
4.If the issue persists after #3, you can:
Open Visual Studio
Click Help > Send Feedback > Report a problem
An instance of Visual Studio Feedback will open
Attempt to sign in using your MS account
If sign in is successful, check if you are signed into Visual Studio
Hint from Nathan Timblin.
Hope all above helps :)

Visual Studio 2013 hanging on getting latest from TFS

In my Visual Studio 2013 I'm trying to get the latest version of a project from TFS but this hangs on until the timeout error occurs.
I've tried deleting the Team Explorer cache a couple of times, undo all the changes, restart, rebuild but still the same issue.
What's even more interesting is that there someone else in my team with a similar version of Visual Studio that hangs when getting the latest on the same project.
We're using VSO so I was expecting this will not have issues.
Any ideas?
Thanks,
Andrei
Please make sure if you are running antivirus that your work space is excluded from the rules. Otherwise it has to check each and every file which is a major slow down. Also check your local work space to see if the files are getting copied. Check the event log on the TFS server it may have a reason. Also try using the VS command line to make the same request.

TF31002 Can't connect to TFS online from VS 2012

Problem
I'm using VisualStudio 2012 Ultimate v11.0.50727.1 Update 4 and VisualStudio 2013 Ultimate v12.0.21005 EL and I'm able to connect to TFS through any browser. But suddenly I can't connect to TFS at xxxxx.VisualStudio.com from within VisualStudio anymore. Yesterday I easily did a Check-In at work with the same account. but I can't connect to TFS at home.
This is the URL I'm using: (I've tried changing it a bit like adding /tfs or /DefaultCollection)
I'm stuck with this, I've tried different ways but none have worked so far and it's still giving me these errors: TF31002, TF300324 and TF205020
TF31002 (this error happens when trying to Add a new server)
TF205020: Could not connect to server ‘https://xxxxxx.visualstudio.com/defaultcollection’. This server was used in your last session, but it might be offline or unreachable. Confirm that the server is available on the network. To attempt to connect again, or to a different server, click ‘Connect To Team Foundation Server’ in Team Explorer or the Team menu.
TF400324: Team Foundation services are not available from server https://xxxxxx.visualstudio.com/defaultcollection.
Technical information (for administrator):
The underlying connection was closed: An unexpected error occurred on a send.
(The last 2 errors happen when VisualStudio is trying to login to tfs)
I've tried these:
Go to VisualStudio.com and Sign out from all browsers
Delete Cookies and Caches of IE10 (and test when IE has signed in to visualstudio.com or signed out of it)
Go to Regedit and set the DWORD to 0 in HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\TeamFoundation\Instances
Browse to %LocalAppData%\Microsoft\Team Foundation\4.0\Cache and delete everything
Delete all credentials from Windows Credential Manager (and remove Link Online ID)
Installed VS2013
Installed Team Explorer 2013
Installed VS2012 Update 4
Installed a fresh copy of Windows 8
What I want.
After some long and desperate time of trying to connect to TFS online, Now I'm just looking for a way to Check-in my changes. (doing it by hand is not an option because there's a large number of changes and I can't even know which files are changed since last check-in)
I just saw this link and it totally worked for me after nothing else would: http://www.cnblogs.com/CuteNet/p/3556276.html
regedit:
Close all instances of Visual Studio 2013
Delete this folder in the registry (just “TokenStorage” – nothing else):
HKEY_CURRENT_USER\Software\Microsoft\VSCommon\12.0\ClientServices\TokenStorage
I had similar issue where I couldn't connect (TF31002) to TFS 2010 using VS 2010, 2012 and 2013 on my laptop but can connect from web and other servers just fine.
I tried almost all suggestions given by various sources online but had no luck.
I was getting ready to reimage tha laptop but as one last try I started comparing config's between another virtual machine (where the connection was successful) to my laptop. I found that in my laptop I have additional defaultProxy settings in 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config’
<system.net>
<defaultProxy>
<proxy autoDetect="false" bypassonlocal="false" proxyaddress="http://XXX.X.X.X:XXXX" usesystemdefault="false"/>
</defaultProxy>
</system.net>
After deleting the above node completely I was able to connect to TFS 2010 successfully.
Hope this helps.
I've found a way to check-in all changes of the home computer at work computer.
Copy the local TFS folder from home computer (including the hidden $tf subfolder) to work computer.
Install Team Foundation Sidekicks for 2012
Search for the home computer name
Click on Update Workspace Computer Name
Go to Source Control Explorer and open Workspaces...
Check Show remote workspaces checkbox (if the home workspace is not shown)
Edit the home workspace
Remove current mapping
Map $/ to the local folder (which has $tf)
When click on Advanced It should look like this:
Switch to the new Workspace and done!
It seems to me that private workspace is what causing the problem, and I will try to change it to public after I checked in.
Edit
I've found another workaround which requires no workspace hacks. (This method is originally designed for recovering from wrong check-ins)
In Source Control Explorer select root (collection, not project)
click Compare folders
in source version section choose the latest safe version
in target path section browse to the not-checked-in folder
make sure both paths end with same name (e.g. $/MyProj and E:\FromHome\TFS\MyProj)
(set any additional settings...) and click OK
DoubleClick on files with different value of Yes and write down the names of those file that should be loaded from local folder (right part of screen probably shows local)
Open those files from Solution Explorer and overwrite them with local files
I faced the same issue few days back
1. Disable your firewall(not recommended)
2. Run VS 2013 in admin mode.
3. Disable antivirus or add TFS in whitelist.
4. Select connect to TFS and create a new project in another directory (Local copy)
5. Check the directory for access(Read only by default change the permissions)
6. try to check in now.
After changing the permissions to the local directory i was able to check in my changes.
I was having the same issues using Visual Studio 2013 Update 2 and for me the problem was Anti-Virus software (Kaspersky Endpoint Security 8). See this link: http://blogs.msdn.com/b/dstfs/archive/2014/07/24/can-t-connect-to-visual-studio-online-from-any-version-of-in-vs-quot-the-underlying-connection-was-closed-an-unexpected-error-occurred-on-a-send-quot.aspx
Check your URL first!
I had a problem with such URL:
https://domain-name.com
Turns out that symbol "-" where replaced with some special char ­. But Visual Studio 2012(2013) did not indicate that anyhow. Apparently it was not able to find such domain. As result same issue TF31002 and a day spent in research.
I was having a similar problem with Visual Studio Premium 2013 connecting to our project from inside VS. It kept returning TF31002, but I could access it with a browser.
From the browser I went to Home->Activities->Open New instance of Visual Studio and my tfs project loaded right into the Team Explorer frame.
Hope that helps.
I had the same issue when I wanted to connect to the TFS with Visual Studio. This solved my problem:
I used a VPN connection to the server
I used the ip address instead of the link given by the TFS (http://"ip address":8080/tfs instead of http://"link":8080/tfs)

Opening VS solution in VS 2008 after it's already been opened in VS 2010?

I have a Visual Studio project solution for a SSRS reporting service that must be opened in VS 2008 in order to function correctly, however I accidentally opened it from VS2010 and now cannot get the file to revert back due to something on my local box. I have Deleted the solution folder and "gotten latest" from the server via the source controller (which I know has not yet been upgraded), however some clinging footprint is keeping it from reverting back and still references the .sln file as being a VS2010 and gives me the below error. Any ideas?
"*.rptproj cannot be opened because it's project type is not supported by the application."
Although a surprising fix, the problem was being caused by a missing service pack on my SQL Server 2008 R2, after pushing that update, the VS 2008 is able to open the report solution no problem.

Resources