vstest icon indicating copy to clipboard operation
vstest copied to clipboard

VS2022 Preview (17.11.0 Preview 2.0): Exception: "Support for Windows containers in Docker is not enabled." when trying to access windows container

Open bevanweiss opened this issue 1 year ago • 4 comments

Description

I've got a solution with an xUnit Test project within it. I've configured a testenvironments.json file as below

{
    "version": "1",
    "environments": [
        {
            "name": "Windows ltsc2022",
            "type": "docker",
            "dockerFile": "../../../testdocker/Dockerfile"
        }
    ]
}

and then I have a Dockerfile that is incredibly naive... but should be ok for now (it's to test MSI packages, so nothing beyond base OS is required)

# Use the latest Windows Server Core 2022 image.
FROM mcr.microsoft.com/windows/servercore:ltsc2022

Steps to reproduce

When I open the Test Explorer, all looks good, and I can see the remote container in the drop down list. image

However when I select the remote container, it generates an exception telling me that support for Windows containers in Docker is not enabled.. image

However if I go to a command line, I can run that Docker file without a problem image

Expected behavior

I expect the Visual Studio Test Runner to launch the (Windows) docker container, and to connect to it. Which would then allow for the Test Suite to be run from inside the container.

Actual behavior

Docker container is not started. Misleading diagnostic message "Connected to test environment..." is displayed. Exception and stack trace is reported, again with misleading information suggesting the problem is the Docker application setup.

Diagnostic logs

Connected to test environment 'Windows ltsc2022' System.Exception: Support for Windows containers in Docker is not enabled. at Microsoft.VisualStudio.TestWindow.Host.TestPlatformProviders.DockerTestPlatformProvider.<ActivateSessionAsync>d__17.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.TestWindow.Host.TestPlatformAgentPool.<>c__DisplayClass24_0.<<CreateRemoteAgentAsync>b__0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.TestWindow.Utilities.EventPumpExtensions.<>c__DisplayClass4_01.<<EnqueueAsync>b__1>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.TestWindow.Extensibility.TaskCompletionSourceExtensions.<RunTaskWithCatchAsync>d__11.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.TestWindow.Logging.ILoggerExtensions.<CallWithCatchAsync>d__131.MoveNext() System.Exception: Support for Windows containers in Docker is not enabled. at Microsoft.VisualStudio.TestWindow.Host.TestPlatformProviders.DockerTestPlatformProvider.<ActivateSessionAsync>d__17.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.TestWindow.Host.TestPlatformAgentPool.<>c__DisplayClass24_0.<<CreateRemoteAgentAsync>b__0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.TestWindow.Utilities.EventPumpExtensions.<>c__DisplayClass4_01.<<EnqueueAsync>b__1>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.TestWindow.Extensibility.TaskCompletionSourceExtensions.<RunTaskWithCatchAsync>d__11.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.TestWindow.Logging.ILoggerExtensions.<CallWithCatchAsync>d__131.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.TestWindow.Host.TestPlatformProvider.<UpdateRuntimeEnvironmentsAsync>d__13.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.TestWindow.Logging.ILoggerExtensions.<CallWithCatchAsync>d__14`1.MoveNext()

Environment

Windows 11 22H2 (OS Build 22621.3737) VSTest version 17.11.0-preview-24263-02 (x64) Docker Desktop 4.31.1 (153621)

bevanweiss avatar Jun 18 '24 07:06 bevanweiss

@peterwald please have a look, this seems specific to TE and the functionality you worked on.

nohwnd avatar Jun 18 '24 09:06 nohwnd

We don't currently enable support for remote testing in Windows containers in Docker, only Linux containers.

There are quite a few technical differences that make it difficult to maintain and we have been seeking feedback from our users as to whether it would be worthwhile to invest in.

/cc @AbhitejJohn

peterwald avatar Jun 18 '24 11:06 peterwald

@peterwald Is there any estimate for when Test runs in Windows (amd64 on amd64) Containers would be available for early testing? It'd be nice if rather than crashing out with an Exception, it provided a large warning text (both top and bottom of the console sequence).. but then did attempt to do stuff (at least launching the container would have been expected).

My particular test case is MSI deployments, where there are .NET 'tests' which validate certain aspects of the MSI deployments within the container (so that restoring to reproducible state is trivial).

bevanweiss avatar Jun 18 '24 12:06 bevanweiss

@peterwald @AbhitejJohn please link a ticket (if you have one) where you are collecting this feedback, so we can close this issue here. 🙏

nohwnd avatar Jul 08 '24 17:07 nohwnd

Ping on this one @peterwald

nohwnd avatar Jun 12 '25 13:06 nohwnd

At this point, we do not have any plans to roll out support for remote testing in Windows containers.

peterwald avatar Jun 12 '25 14:06 peterwald