This project has moved. For the latest updates, please go here.
2
Vote

Application crash in System.Net.Sockets.Socket.DoConnect

description

Hi!
I'm using desktop application with connection to TFS 2015.1 server. OS is Windows 7.
But I contineously have a crash of application in case of unstable network connection.

Exception is following.
Do we have a way to avoid this?

Application: TeamBuildScreen.Tfs.Desktop.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Net.Sockets.SocketException
at System.Net.Sockets.Socket.DoConnect(System.Net.EndPoint, System.Net.SocketAddress)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean, System.Net.Sockets.Socket, System.Net.Sockets.Socket, System.Net.Sockets.Socket ByRef, System.Net.IPAddress ByRef, ConnectSocketState, System.IAsyncResult, System.Exception ByRef)

Exception Info: System.Net.WebException
at System.Net.HttpWebRequest.GetRequestStream(System.Net.TransportContext ByRef)
at System.Net.HttpWebRequest.GetRequestStream()
at Microsoft.TeamFoundation.Client.Channels.TfsHttpWebRequest.SendRequestAndGetResponse(System.Net.HttpWebRequest, System.Net.WebException ByRef)

Exception Info: Microsoft.TeamFoundation.TeamFoundationServiceUnavailableException
at Microsoft.TeamFoundation.Client.Channels.TfsHttpWebRequest.ReadResponse(System.Net.HttpWebResponse, System.Net.WebException)
at Microsoft.TeamFoundation.Client.Channels.TfsHttpWebRequest.IsAuthenticationChallenge(Microsoft.TeamFoundation.Client.Channels.TfsMessage, System.Net.HttpWebResponse, System.Net.WebException, Microsoft.TeamFoundation.Client.Channels.TfsMessage ByRef)
at Microsoft.TeamFoundation.Client.Channels.TfsHttpWebRequest.SendRequest()
at Microsoft.TeamFoundation.Client.Channels.TfsHttpRequestChannel.Request(Microsoft.TeamFoundation.Client.Channels.TfsMessage, System.TimeSpan)
at Microsoft.TeamFoundation.Client.Channels.TfsHttpClientBase.Invoke(Microsoft.TeamFoundation.Client.Channels.TfsClientOperation, System.Object[], System.TimeSpan, System.Object[] ByRef)
at Microsoft.TeamFoundation.Server.Classification.ListAllProjects()
at Microsoft.TeamFoundation.Proxy.CommonStructureService.ListAllProjects()
at TeamBuildScreen.Tfs.Models.BuildServerService.QueryREST()
at TeamBuildScreen.Tfs.Models.BuildServerService.Query()
at TeamBuildScreen.Core.Models.BuildServerServiceBase.Query(System.Object)
at System.Threading.TimerQueueTimer.CallCallbackInContext(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.TimerQueueTimer.CallCallback()
at System.Threading.TimerQueueTimer.Fire()
at System.Threading.TimerQueue.FireNextTimers()
at System.Threading.TimerQueue.AppDomainTimerCallback()

comments

Grifplex wrote Jun 21 at 11:44 PM

I have fixed this with the following change:
--- a/Main/Source/TeamBuildScreen.Core/Models/BuildServerServiceBase.cs
+++ b/Main/Source/TeamBuildScreen.Core/Models/BuildServerServiceBase.cs
@@ -62,7 +62,14 @@ namespace TeamBuildScreen.Core.Models

         private void Query(object stateInfo)
         {
-            this.Query();
+            try
+            {
+                this.Query();
+            }
+            catch(Exception e)
+            {
+                this.Error(this, new StringEventArgs(e.Message));
+            }
         }

         public abstract void Query();

wrote Jun 21 at 11:45 PM