A SocketException can occur when the ImageInline source is assigned to a link pointing to a picture on a remote server (a website). For example: UriSource ="https://docs.telerik.com/devtools/wpf/knowledge-base/images/kb-chartview-categorical-and-datetime-axis-0.png"
This could happen during the fetching of the image stream. In some cases, the server may give a NetworkStream or ConnectionStream, or similar Stream implementation, which keeps an open connection between the application and the server. If the connection get severed during the stream reading, an exception is thrown.
The exception message is: "Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host."
The stacktrace is:
Exception Info: System.Net.Sockets.SocketException
at System.Net.Sockets.NetworkStream.Read(Byte[], Int32, Int32)
Inner Exception:
Exception Info: System.IO.IOException
at System.Net.ConnectStream.Read(Byte[], Int32, Int32)
at System.IO.Stream.InternalCopyTo(System.IO.Stream, Int32)
at Telerik.Windows.Documents.Layout.ExtensionMethods.ToMemoryStream(System.IO.Stream)
at Telerik.Windows.Documents.Model.ImageInline.<SetStreamFromUriSource>b__0(System.Object, StreamReadyEventArgs)
at Telerik.Windows.Documents.Utils.ResourceStreamLocator.OnStreamReady()
at System.Net.WebClient.OnOpenReadCompleted(System.Net.OpenReadCompletedEventArgs)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(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.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
at System.Windows.Application.RunDispatcher(System.Object)
at System.Windows.Application.RunInternal(System.Windows.Window)