Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to debug individual google tests in visual studio 2022 cmake project #4959

Open
dbollish1 opened this issue Apr 2, 2024 · 0 comments

Comments

@dbollish1
Copy link

dbollish1 commented Apr 2, 2024

Description

Trying to debug a single unit test written in c++ and google test adapter from the Test Explorer in Visual Studio 2022 (v17.9.5)

Results in the following output:
[4/2/2024 11:02:47.778 AM] Test Adapter for Google Test: Test execution starting...
[4/2/2024 11:02:47.800 AM] Running 1 tests...
[4/2/2024 11:02:47.815 AM] Attaching debugger to C:\src\git\LMDB\LMDB\out\build\x64-debug\bin\MolDB.UnitTest.exe
[4/2/2024 11:02:47.824 AM] Debug Engine Guids: 3b476d35-a401-11d2-aad4-00c04f990171
[4/2/2024 11:02:47.824 AM] ** Launching debugger **
[4/2/2024 11:02:47.824 AM] . Launched process : C:\src\git\LMDB\LMDB\out\build\x64-debug\bin\MolDB.UnitTest.exe
. Arguments : --gtest_catch_exceptions=1 --gtest_break_on_failure=0
. Current directory : C:/src/git/LMDB/LMDB/out/build/x64-debug/src/MoleculeDB/MolDB.UnitTest
. Environment variables :
. Launch Debug Engine GUID : 3b476d35-a401-11d2-aad4-00c04f990171
. Other options :
. AppPackageLaunchInfo :
[4/2/2024 11:02:47.835 AM] [Error] System.Runtime.InteropServices.COMException (0x89710016): Unable to start program 'C:\src\git\LMDB\LMDB\out\build\x64-debug\bin\MolDB.UnitTest.exe'.

The specified working directory does not exist or is not a full path.
at Microsoft.VisualStudio.Shell.Interop.IVsDebuggerLaunchAsync.LaunchDebugTargetsAsync(UInt32 debugTargetCount, VsDebugTargetInfo4[] debugTargetArray, IVsDebuggerLaunchCompletionCallback completionCallback)
at Microsoft.VisualStudio.TestWindow.ShellServices.DebuggerService.<>c__DisplayClass25_0.<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.Logging.ILoggerExtensions.d__11`1.MoveNext()
[4/2/2024 11:02:47.837 AM] [Error] The active test run was aborted. Reason: Exception of type 'Microsoft.VisualStudio.TestPlatform.ObjectModel.TestPlatformException' was thrown.

This issue only occurs when trying to debug the test, if the test is selected to run (without debugging), it executes successfully.
The error message complains that the working directory does not exist but I have verified that the path is valid and does exist.

Steps to reproduce

open attached cmake project in visual studio. Build and then in test explorer, try to debug the GetSchemaVersion test and the above error trace will occurr.

Expected behavior

Selected unit test starts with debugger attached and able to stop at breakpoints in the test method.

Actual behavior

Test does not start and error message is displayed in the test output window.

Diagnostic logs

Environment

Windows 10.0.19044, Visual Studio 2022 (v17.9.5)
googleTest.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant