Skip to content

IFrameworkHandle.LaunchProcessWithDebuggerAttached allows null for workingDirectory in signature but throws #5170

Closed
@bradwilson

Description

@bradwilson

Description

According to the nullable annotations, IFrameworkHandle.LaunchProcessWithDebuggerAttached is allowed to pass a null for workingDirectory.

However, when I do so, I see my test process crash with the following stack trace:

StreamJsonRpc.RemoteInvocationException: Value cannot be null.
Parameter name: workingDirectory
   at StreamJsonRpc.JsonRpc.<InvokeCoreAsync>d__154`1.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__11`1.MoveNext()
RPC server exception:
System.ArgumentNullException: Value cannot be null.
Parameter name: workingDirectory
      at Microsoft.VisualStudio.TestWindow.Extensibility.ValidateArg.NotNull[T](T arg, String parameterName)
      at Microsoft.VisualStudio.TestWindow.Extensibility.ValidateArg.NotNullOrEmpty[T](IEnumerable`1 arg, String parameterName)
      at Microsoft.VisualStudio.TestWindow.Core.Debugging.DebugLauncher.<LaunchProcessUnderDebuggerInternalAsync>d__7.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.Core.Debugging.DebugLauncher.<LaunchProcessUnderDebuggerAsync>d__5.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.Client.TestWindowServiceCallback.<LaunchDebugTestHostAsync>d__14.MoveNext()

The active test run was aborted. Reason: Exception of type 'Microsoft.VisualStudio.TestPlatform.ObjectModel.TestPlatformException' was thrown.

Steps to reproduce

Call IFrameworkHandle.LaunchProcessWithDebuggerAttached with a null value for workingDirectory.

Expected behavior

Process is launched into the debugger with the current working directory.

Actual behavior

Exception is thrown and the test process crashes.

Diagnostic logs

There are no instructions on collecting diagnostic logs when using Test Explorer, and this can only be reproduced in Test Explorer.

Environment

Windows 11 23H2 (22631.3880)
Visual Studio 2022 17.10.4
.NET SDK 8.0.303

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions