Community

Start a Thread


Notifications
Subscribe You’re not receiving notifications from this thread.

C# Code Environment is not working!

Feedback • Asked almost 2 years ago by Abi Learning

Abi Learning Commented on Dec 07, 2023:

I tried to solve couple of challenges in C# and every time I am getting the following exception:

Please assist.

Testhost process exited with error: Unhandled exception. System.Net.Sockets.SocketException (101): Network is unreachable
at System.Net.Sockets.Socket.BeginConnectEx(EndPoint remoteEP, Boolean flowContext, AsyncCallback callback, Object state)
at System.Net.Sockets.Socket.UnsafeBeginConnect(EndPoint remoteEP, AsyncCallback callback, Object state, Boolean flowContext)
at System.Net.Sockets.Socket.BeginConnect(EndPoint remoteEP, AsyncCallback callback, Object state)
at System.Net.Sockets.Socket.BeginConnect(IPAddress address, Int32 port, AsyncCallback requestCallback, Object state)
at System.Net.Sockets.TcpClient.BeginConnect(IPAddress address, Int32 port, AsyncCallback requestCallback, Object state)
at System.Net.Sockets.TcpClient.c.b_270(IPAddress targetAddess, Int32 targetPort, AsyncCallback callback, Object state)
at System.Threading.Tasks.TaskFactory1.FromAsyncImpl[TArg1,TArg2](Func5 beginMethod, Func2 endFunction, Action1 endAction, TArg1 arg1, TArg2 arg2, Object state, TaskCreationOptions creationOptions)
at System.Threading.Tasks.TaskFactory.FromAsyncTArg1,TArg2
at System.Threading.Tasks.TaskFactory.FromAsyncTArg1,TArg2
at System.Net.Sockets.TcpClient.ConnectAsync(IPAddress address, Int32 port)
at Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.SocketClient.Start(String endPoint)
at Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.TestRequestHandler.InitializeCommunication()
at Microsoft.VisualStudio.TestPlatform.TestHost.DefaultEngineInvoker.Invoke(IDictionary`2 argsDictionary)
at Microsoft.VisualStudio.TestPlatform.TestHost.Program.Run(String[] args)
at Microsoft.VisualStudio.TestPlatform.TestHost.Program.Main(String[] args)
. Please check the diagnostic logs for more information.
Test Run Aborted.

Team AlgoDaily Commented on Dec 20, 2023:

Hi Abi, this should be resolved -- can you confirm this is the case for you?

Ben Commented on Jun 11, 2025:

I was hitting the same SocketException earlier today. Just retried a couple of C# challenges and it’s working now on my end.

If anyone still sees it:
- Hard refresh the page or reopen the runner
- Sign out/in
- Disable VPN/firewall temporarily
- Try a different network

Curious: why does the test host need a network socket here? Is the runner connecting to a remote test service?

Team AlgoDaily Commented on Jun 30, 2025:

Thanks for the reports. We pushed a fix earlier—our runner sandbox briefly blocked the loopback socket the .NET testhost uses, which caused the “Network is unreachable” error. It should be stable now.

Ben’s question: the .NET test platform (vstest) spins a separate “testhost” process and communicates with it over TCP, even locally. In our setup that’s a loopback connection inside the container (127.0.0.1). It’s not calling a remote service or the public internet.

If you still hit it:
- Click Reset/Restart Runner to get a fresh sandbox
- Hard refresh the page
- Sign out/in

If it persists, drop the challenge name, time of failure, and browser/OS so we can pull logs.