dotnet-test-nunit: SocketException when discovering tests

853 views
Skip to first unread message

Chris Maddock

unread,
Jun 2, 2016, 4:55:10 PM6/2/16
to NUnit Developer List
Rob - after your comments earlier, I thought I'd have a poke around in the dotnet-test solution - but I'm having problems getting up and running. 

Can I take it from your screen shots that the adapter is currently in a state that it can view tests in the VS test explorer? Should that happen on build with the tests in this solution - or is there some sort of 'publish' step to tell VS about the adapter?

So far, I've built the solution and can run the tests in the solution with dotnet run (which have the nunit lite runner built in.) When I build however, test discovery reports the following exception - not sure if a) this is expected at this stage or not, and b) how to debug it if not!

Can you point me in the right direction?

Discovering tests in 'C:\Users\Chris\Documents\git\dotnet-test-nunit\test\dotnet-test-nunit.test\project.json' ["C:\Program Files\dotnet\dotnet.exe" test "C:\Users\Chris\Documents\git\dotnet-test-nunit\test\dotnet-test-nunit.test\project.json" --output "C:\Users\Chris\Documents\git\dotnet-test-nunit\test\dotnet-test-nunit.test\bin\Debug\netcoreapp1.0" --port 56860 --parentProcessId 10068 --no-build]
Unable to start C:\Program Files\dotnet\dotnet.exe
dotnet-test Error: 0 : [ReportingChannel]: Waiting for message failed System.IO.IOException: Unable to read data from the transport connection: An established connection was aborted by the software in your host machine. ---> System.Net.Sockets.SocketException: An established connection was aborted by the software in your host machine
   at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
   at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
   --- End of inner exception stack trace ---
   at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
   at System.IO.Stream.ReadByte()
   at System.IO.BinaryReader.ReadByte()
   at System.IO.BinaryReader.Read7BitEncodedInt()
   at System.IO.BinaryReader.ReadString()
   at Microsoft.DotNet.Tools.Test.ReportingChannel.ReadMessages()

Unhandled Exception: System.IO.IOException: Unable to read data from the transport connection: An established connection was aborted by the software in your host machine. ---> System.Net.Sockets.SocketException: An established connection was aborted by the software in your host machine
   at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
   at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
   --- End of inner exception stack trace ---
   at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
   at System.IO.Stream.ReadByte()
   at System.IO.BinaryReader.ReadByte()
   at System.IO.BinaryReader.Read7BitEncodedInt()
   at System.IO.BinaryReader.ReadString()
   at Microsoft.DotNet.Tools.Test.ReportingChannel.ReadMessages()
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
dotnet-test Error: 0 : [ReportingChannel]: Error sending System.IO.IOException: Unable to write data to the transport connection: Cannot access a disposed object.
Object name: 'System.Net.Sockets.Socket'.. ---> System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'System.Net.Sockets.Socket'.
   at System.Net.Sockets.Socket.Send(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags, SocketError& errorCode)
   at System.Net.Sockets.Socket.Send(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
   at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size)
   --- End of inner exception stack trace ---
   at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size)
   at System.IO.BinaryWriter.Write7BitEncodedInt(Int32 value)
   at System.IO.BinaryWriter.Write(String value)
   at Microsoft.DotNet.Tools.Test.ReportingChannel.Send(Message message)
dotnet-test Error: 0 : System.IO.IOException: Unable to write data to the transport connection: Cannot access a disposed object.
Object name: 'System.Net.Sockets.Socket'.. ---> System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'System.Net.Sockets.Socket'.
   at System.Net.Sockets.Socket.Send(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags, SocketError& errorCode)
   at System.Net.Sockets.Socket.Send(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
   at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size)
   --- End of inner exception stack trace ---
   at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size)
   at System.IO.BinaryWriter.Write7BitEncodedInt(Int32 value)
   at System.IO.BinaryWriter.Write(String value)
   at Microsoft.DotNet.Tools.Test.ReportingChannel.Send(Message message)
   at Microsoft.DotNet.Tools.Test.ReportingChannel.SendError(String error)
   at Microsoft.DotNet.Tools.Test.ReportingChannel.SendError(Exception ex)
   at Microsoft.DotNet.Tools.Test.DesignTimeRunner.HandleDesignTimeMessages(ProjectContext projectContext, DotnetTestParams dotnetTestParams)
   at Microsoft.DotNet.Tools.Test.DesignTimeRunner.DoRunTests(ProjectContext projectContext, DotnetTestParams dotnetTestParams)
   at Microsoft.DotNet.Tools.Test.BaseDotnetTestRunner.RunTests(ProjectContext projectContext, DotnetTestParams dotnetTestParams, BuildWorkspace workspace)
   at Microsoft.DotNet.Tools.Test.TestCommand.DoRun(String[] args)

Rob Prouse

unread,
Jun 2, 2016, 9:04:11 PM6/2/16
to nunit-developer
Chris,

You aren't doing anything wrong, I get the same results, that is why I originally thought the Visual Studio integration was broken. The screenshots I posted were from a clean .NET Core project with tests that includes the adapter as a NuGet feed from AppVeyor. If you do that, it works as expected. I will post a quick start for that once I get it a little further along.

The fact that it isn't working in VS right now makes it hard to debug when in VS, but the console runner version is working. I think I still need to do some cleaning up there, so will post more once I do a bit more testing. I had trouble with the XUnit project too, so we aren't alone.

Rob

--
You received this message because you are subscribed to the Google Groups "NUnit Developer List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nunit-develop...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Rob Prouse

 

I welcome VSRE emails. Learn more at http://vsre.info/

Message has been deleted
Message has been deleted

Chris Maddock

unread,
Jun 4, 2016, 9:48:30 AM6/4/16
to NUnit Developer List
It looks like the Google group has auto-deleted my last post as spam - presumably because of the stack trace and JSON. Don't know if that's still visible to you, Rob.

Rob Prouse

unread,
Jun 7, 2016, 9:46:35 AM6/7/16
to NUnit Developer List
I approved your messages. They were in the spam queue, not sure why.

Does running dotnet test from the command line work for you? Your project.json looks good. I had to add a runtimes element though. Here is my project.json. The NUnitCore dependency is the project under test.

{
    "version": "1.0.0-*",
    "testRunner": "nunit",

    "dependencies": {
        "NUnit": "3.2.0",
        "dotnet-test-nunit": "3.3.0.33-CI",
        "NUnitCore": "1.0.0"
    },

    "frameworks": {
        "netstandard1.5": {
            "imports": [
                "netcoreapp1.0",
                "portable-net45+win8"
            ]
        }
    },

    "runtimes": {
        "win10-x86": {},
        "win10-x64": {}
    }
}




On Sat, Jun 4, 2016 at 10:49 AM Chris Maddock <chrism...@live.co.uk> wrote:
Great - thanks! Will have a shot at it with a clean test project tonight.
Chris

Chris Maddock

unread,
Jun 10, 2016, 5:28:17 AM6/10/16
to NUnit Developer List
Thanks Rob. Yes, dotnet test on command line was fine, just Visual Studio Test Explorer didn't pick up anything. Which is a little odd, given it was throwing all the exceptions in the other solution! 

Bit flat out at the moment, but will hopefully have another look next week!

Rob Prouse

unread,
Jun 14, 2016, 11:07:06 AM6/14/16
to nunit-d...@googlegroups.com
Chris,

In your project.json, you need to use a newer version of dotnet-test-nunit. You are using 3.3.0.1-CI which doesn't have test discovery yet. You need 3.3.0.69-CI.

Rob

Chris Maddock

unread,
Jun 25, 2016, 10:55:59 AM6/25/16
to NUnit Developer List
Thanks for this Rob, sorry I didn't get back - it's been a while since I've been back at the right machine. Text Explorer is up and running, thanks for your help!
Reply all
Reply to author
Forward
0 new messages