TfsSearchCode fails after making connection


After entering the ip address and credentials, the application makes a conneciton and then fails with the following error:
************** Exception Text **************
System.InvalidOperationException: Operation has been cancelled.
at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary()
at System.ComponentModel.RunWorkerCompletedEventArgs.get_Result()
at TfsSearchCodeDesktop.frmMain.BackgroundWorker2_RunWorkerCompleted(Object sender, RunWorkerCompletedEventArgs e)
at System.ComponentModel.BackgroundWorker.OnRunWorkerCompleted(RunWorkerCompletedEventArgs e)
at System.ComponentModel.BackgroundWorker.AsyncOperationCompleted(Object arg)
I've tried connecting to both TFS 2005 and 2008 servers with the same results.

file attachments


KenBeccard wrote Jun 17, 2009 at 2:16 PM

I had the same problem and I traced this in the source code. It turns out that I wasn't actually connecting to TFS correctly because we're configured to use Windows authentication and the code is set up to assume that a username/password must be provided. There needs to be a provision in the code to allow for the different types of authentication. I modified the instantiation of the TeamFoundationServer obect to use TeamFoundationServerFactory and provided no credentials. This seeemed to make it work.

MichaelHauer wrote Dec 3, 2009 at 11:02 AM

I modified the ConnectToServer method to use the default credentials (= Windows authentication) wenn no username and password are provided:

If String.IsNullOrEmpty(Login) And String.IsNullOrEmpty(Password) Then
    MyCred = System.Net.CredentialCache.DefaultNetworkCredentials
    MyCred = New System.Net.NetworkCredential(Login, Password)
End If

wrote Dec 3, 2009 at 2:09 PM

wrote Apr 1, 2010 at 6:58 PM

dmrcgyap wrote Apr 1, 2010 at 6:59 PM

I also have this problem, I made the same change above to use default (windows) credentials if username is left blank.

wrote Jan 3, 2011 at 1:19 PM

sqrt32 wrote Jan 3, 2011 at 1:22 PM

I also have same problem.
1) When i supply to the current code, the current windows user and password, what is the difference in the authentication process?
2) I had to change the code myself, or wait for the code page be updated iwht this fix?
Sqrt32 (aka Bert)

wrote Feb 14, 2013 at 1:27 AM