microsoft / PTVS

Python Tools for Visual Studio
https://aka.ms/PTVS
Apache License 2.0
2.53k stars 676 forks source link

Test debugging doesn't work #6796

Open AdamYoblick opened 2 years ago

AdamYoblick commented 2 years ago

In today's build, Breakpoint still can not be hit.

image Debug info

``` 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\Extensions\TestPlatform\testhost.x86.exe'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\Extensions\TestPlatform\Microsoft.TestPlatform.CoreUtilities.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\Extensions\TestPlatform\Microsoft.TestPlatform.PlatformAbstractions.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\Extensions\TestPlatform\Microsoft.TestPlatform.CrossPlatEngine.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\Extensions\TestPlatform\Microsoft.TestPlatform.CommunicationUtilities.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\Extensions\TestPlatform\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\Extensions\TestPlatform\Microsoft.VisualStudio.TestPlatform.Common.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\Extensions\TestPlatform\Newtonsoft.Json.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Numerics\v4.0_4.0.0.0__b77a5c561934e089\System.Numerics.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.Serialization\v4.0_4.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml.Linq\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.Linq.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\Extensions\TestPlatform\Extensions\Microsoft.Cci.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Runtime.dll'. Module was built without symbols. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.InteropServices\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Runtime.InteropServices.dll'. Module was built without symbols. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Collections\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Collections.dll'. Module was built without symbols. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\Extensions\TestPlatform\Extensions\Microsoft.TestPlatform.Extensions.BlameDataCollector.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\Extensions\TestPlatform\Extensions\Microsoft.TestPlatform.Extensions.EventLogCollector.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\Extensions\TestPlatform\Extensions\Microsoft.TestPlatform.TestHostRuntimeProvider.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\Extensions\TestPlatform\Microsoft.VisualStudio.ArchitectureTools.PEReader.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\Extensions\TestPlatform\Extensions\Microsoft.VisualStudio.Coverage.Core.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\netstandard\v4.0_2.0.0.0__cc7b13ffcd2ddd51\netstandard.dll'. Module was built without symbols. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ValueTuple\v4.0_4.0.0.0__cc7b13ffcd2ddd51\System.ValueTuple.dll'. Module was built without symbols. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.InteropServices.RuntimeInformation\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Runtime.InteropServices.RuntimeInformation.dll'. Module was built without symbols. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\Extensions\TestPlatform\Extensions\Microsoft.VisualStudio.Coverage.Instrumentation.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\Extensions\TestPlatform\System.Reflection.Metadata.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\Extensions\TestPlatform\System.Collections.Immutable.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\Extensions\TestPlatform\Extensions\Microsoft.VisualStudio.Coverage.Interprocess.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\Extensions\TestPlatform\Extensions\Microsoft.VisualStudio.Fakes.DataCollector.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\Extensions\TestPlatform\Extensions\Microsoft.VisualStudio.TestPlatform.Extensions.CodedWebTestAdapter.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\Extensions\TestPlatform\Extensions\Microsoft.VisualStudio.TestPlatform.Extensions.TmiAdapter.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\Extensions\TestPlatform\Microsoft.VisualStudio.QualityTools.Common.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\Extensions\TestPlatform\Extensions\Microsoft.VisualStudio.TestPlatform.Extensions.Html.TestLogger.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\Extensions\TestPlatform\Extensions\Microsoft.VisualStudio.TestPlatform.Extensions.Trx.TestLogger.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\Extensions\TestPlatform\Extensions\Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\Extensions\TestPlatform\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\Extensions\TestPlatform\Extensions\Microsoft.VisualStudio.TestPlatform.Extensions.WebTestAdapter.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\Extensions\TestPlatform\Extensions\Microsoft.VisualStudio.TestTools.CppUnitTestFramework.ComInterfaces.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\Extensions\TestPlatform\Extensions\Microsoft.VisualStudio.TestTools.CppUnitTestFramework.CppUnitTestExtension.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ComponentModel.Composition\v4.0_4.0.0.0__b77a5c561934e089\System.ComponentModel.Composition.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\Extensions\TestPlatform\Extensions\Microsoft.VisualStudio.TestTools.DataCollection.MediaRecorder.Model.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\Extensions\TestPlatform\Extensions\Microsoft.VisualStudio.TestTools.DataCollection.VideoRecorderCollector.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\Extensions\TestPlatform\Extensions\Microsoft.VisualStudio.TraceDataCollector.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\Extensions\TestPlatform\Microsoft.IntelliTrace.Core.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\Extensions\TestPlatform\Extensions\Mono.Cecil.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\Extensions\TestPlatform\Extensions\Mono.Cecil.Pdb.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\PREVIEW\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\EBF\TESTEXPLORER\Microsoft.VisualStudio.Workspace.ExternalBuildFramework.TestProvider.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\PREVIEW\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\EBF\TESTEXPLORER\Microsoft.VisualStudio.Workspace.ExternalBuildFramework.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\PREVIEW\COMMON7\IDE\EXTENSIONS\BBR4YV0N.CHC\GoogleTestAdapter.TestAdapter.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\PREVIEW\COMMON7\IDE\EXTENSIONS\BBR4YV0N.CHC\GoogleTestAdapter.Core.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\PREVIEW\COMMON7\IDE\EXTENSIONS\BBR4YV0N.CHC\GoogleTestAdapter.Common.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\PREVIEW\COMMON7\IDE\EXTENSIONS\H1K4OMSU.IHY\BoostTestAdapter.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\CommonExtensions\Microsoft\TestWindow\Microsoft.VisualStudio.TestWindow.Interfaces.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\PREVIEW\COMMON7\IDE\EXTENSIONS\H1K4OMSU.IHY\Antlr.DOT.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\PREVIEW\COMMON7\IDE\EXTENSIONS\H1K4OMSU.IHY\Antlr4.Runtime.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\PREVIEW\COMMON7\IDE\EXTENSIONS\MICROSOFT\PYTHON\CORE\Microsoft.PythonTools.TestAdapter.Executor.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\PREVIEW\COMMON7\IDE\EXTENSIONS\MICROSOFT\PYTHON\CORE\Microsoft.PythonTools.Ipc.Json.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\PREVIEW\COMMON7\IDE\EXTENSIONS\MICROSOFT\PYTHON\CORE\Microsoft.PythonTools.Common.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'Microsoft.GeneratedCode'. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'Microsoft.GeneratedCode'. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\Extensions\TestPlatform\NuGet.Frameworks.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\PREVIEW\COMMON7\IDE\EXTENSIONS\MICROSOFT\PYTHON\CORE\Microsoft.PythonTools.VSInterpreters.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\PREVIEW\COMMON7\IDE\EXTENSIONS\MICROSOFT\PYTHON\CORE\Microsoft.Python.Core.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\Extensions\TestPlatform\Microsoft.VisualStudio.Interop.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'testhost.x86.exe' (CLR v4.0.30319: testhost.x86.exe): Loaded 'C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\PREVIEW\COMMON7\IDE\EXTENSIONS\MICROSOFT\PYTHON\CORE\Newtonsoft.Json.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. The thread 0x3878 has exited with code 0 (0x0). The thread 0x2bb8 has exited with code 0 (0x0). The program '[4004] testhost.x86.exe: Program Trace' has exited with code 0 (0x0). The program '[4004] testhost.x86.exe' has exited with code 0 (0x0). ```

Tests info

``` [9/10/2021 7:38:23.219 AM] Interrupt: Enqueueing RunSelectedWithDebugOperation [9/10/2021 7:38:23.220 AM] Enqueue operation 'RunSelectedWithDebugOperation', hashcode:32349052 [9/10/2021 7:38:23.220 AM] Operation left in the the queue: 1 [9/10/2021 7:38:23.225 AM] 'RunSelectedWithDebugOperation', hashcode:32349052 [9/10/2021 7:38:23.225 AM] [9/10/2021 7:38:23.225 AM] Operation Dequeue : 'RunSelectedWithDebugOperation' [9/10/2021 7:38:23.229 AM] Building Test Projects [9/10/2021 7:38:23.238 AM] Start building 1 containers. [9/10/2021 7:38:23.239 AM] Skipping build since no IProjectBasedTestContainer were found. [9/10/2021 7:38:23.239 AM] No IBuildableTestContainers were found. [9/10/2021 7:38:23.239 AM] Completed building containers. [9/10/2021 7:38:23.239 AM] Start updating 1 containers. [9/10/2021 7:38:23.240 AM] Updating containers from Microsoft.PythonTools.TestAdapter.TestContainerDiscovererProject. [9/10/2021 7:38:23.240 AM] test container discoverer executor://pythonprojectdiscoverer/v1, discovered 2 containers [9/10/2021 7:38:23.240 AM] Containers from 'Microsoft.PythonTools.TestAdapter.TestContainerDiscovererProject' : [9/10/2021 7:38:23.240 AM] C:\Users\vting\source\repos\PythonApplication5\PythonApplication5\test_1.py:executor://pythonprojectdiscoverer/v1 [9/10/2021 7:38:23.240 AM] C:\Users\vting\source\repos\PythonApplication5\PythonApplication5\PythonApplication5.py:executor://pythonprojectdiscoverer/v1 [9/10/2021 7:38:23.240 AM] Completed updating containers. [9/10/2021 7:38:23.240 AM] DiscoveryOperation Changed container count is 0 [9/10/2021 7:38:23.241 AM] Failed to identify the set of NuGet packages referenced in project 'PythonApplication5' since the project has not completed loading. [9/10/2021 7:38:23.285 AM] ========== Starting test run ========== [9/10/2021 7:38:23.288 AM] Tests run settings for C:\Users\vting\source\repos\PythonApplication5\PythonApplication5\test_1.py: 3076 C:\Users\vting\source\repos\PythonApplication5\TestResults C:\Users\vting\source\repos\PythonApplication5\ True . [9/10/2021 7:38:24.387 AM] Debug Engine Guids: 449ec4cc-30d2-4032-9256-ee18eb41b62b [9/10/2021 7:38:24.387 AM] ** Launching debugger ** [9/10/2021 7:38:24.387 AM] . Launched process : [9/10/2021 7:38:25.241 AM] ** Launched debugger Successfully ** [9/10/2021 7:38:25.797 AM] cd C:\Users\vting\source\repos\PythonApplication5\PythonApplication5\ [9/10/2021 7:38:25.798 AM] set PYTHONPATH=C:\Users\vting\source\repos\PythonApplication5\PythonApplication5;C:\Users\vting\source\repos\PythonApplication5\PythonApplication5\ [9/10/2021 7:38:25.800 AM] "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python39_64\python.exe" "C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\PREVIEW\COMMON7\IDE\EXTENSIONS\MICROSOFT\PYTHON\CORE\visualstudio_py_testlauncher.py" -t test_1.Test_test_1.test_A -r 54819 [9/10/2021 7:38:25.972 AM] Connected to socket [9/10/2021 7:38:25.982 AM] Connection event fired [9/10/2021 7:38:26.906 AM] ========== Test run finished: 1 Tests (0 Passed, 1 Failed, 0 Skipped) run in 2.4 sec ========== ```

Originally posted by @ttSpace in https://github.com/microsoft/PTVS/issues/6686#issuecomment-916700297

AdamYoblick commented 2 years ago

Please see #6686 for details about how to repro this

ttSpace commented 2 years ago

In today's build 17.2.0 Preview 3.0 [32307.414.main], Python Package 17.0.22059.4. Failed to debug tests. Breakpoints in tests can't be hit.

Fail_to_debug

linette-zyy commented 2 years ago

This issue can reproduce on my environment. From 17.1.6 ungrade to 17.2.0 [32505.173.d17.2], python package 17.0.22089.1 Failed to hit breakpoint

int19h commented 2 years ago

The issue here is broader than breakpoints; the debug session is simply never set up properly, so nothing is actually being debugged.

The problem is that the test executor process (the one that sits between VS and the actual Python test runner) needs to be able to invoke VS APIs to set things up, and it does so via VisualStudioProxy that it instantiates using a port number that ought to be propagated from the VS process via environment variables:

https://github.com/microsoft/PTVS/blob/c54301297e490161433b0a6d39ff0ecd4ff1972c/Python/Product/PythonTools/PythonToolsPackage.cs#L476-L478

https://github.com/microsoft/PTVS/blob/984cd41766ea27a9b6ac304b437031e7d880899d/Python/Product/TestAdapter.Executor/UnitTest/UnitTestTestExecutor.cs#L51-L53

https://github.com/microsoft/PTVS/blob/61c71535a215735f5f307f35a2ad060c8539cb97/Python/Tests/TestRunnerInterop/VisualStudioApp.cs#L41-L53

However, the variable isn't actually propagated to the test executor process. It is likely due to changes in how VS spawns the test executor process internally, since PTVS is not really in control of that.

int19h commented 2 years ago

The reason why it's not propagated is due to timing of processes involved. In VS 2022, there's a grand total of 4 processes here end-to-end, spawned like so: VS → vstest.console.exe → testhost.exe → Python. However, the vstest.console process in particular is spawned as soon as Test Explorer is visible. If this happens before PTVS package gets loaded (i.e. before the first Python project or folder is opened, usually), it doesn't see _PTVS_PID, since it wasn't set yet. The workaround is to load the project first - then everything works as it should.

It's unclear how to fix it. We can't make PTVS itself load unconditionally on VS startup because that would slow it down significantly. It might be possible to introduce a separate tiny package that is loaded on startup and just sets the env var, but even then the module load would contribute to perf.

Ideally, we should look into the modern VS extensibility APIs to see if all this is even necessary. Our Test Explorer integration was originally written back when Test Explorer itself was a .NET-only thing, and Python was hacked on top of that. If newer APIs allow for custom test runners to be registered in a way that provides a communication channel to VS, we might be able to skip all this complexity. Still, it would be a major rewrite of Test Explorer integration.

int19h commented 2 years ago

Looking at NTVS (which was originally a fork), they worked around this by using WMI to look up the "devenv" parent process. This is a viable short-term fix, but we should still consider it a hack that's likely to break in foreseeable future.

https://github.com/microsoft/nodejstools/blob/ef41a3562a213f0127cb443042bbb90ba9dd56f1/Nodejs/Product/TestAdapter/TestExecutorWorker.cs#L321-L348

int19h commented 2 years ago

This document covers the preferred approach:

https://github.com/microsoft/vstest-docs/blob/main/RFCs/0029-Debugging-External-Test-Processes.md

It seems that the changes necessary to do things "the right way" might not be that extensive, after all.

AdamYoblick commented 1 year ago

Sounds like we have to refactor the test explorer PTVS code to do it the "right way" as Pavel mentioned.

Peter-Svahn commented 10 months ago

I just noted that this works fine in VS Code! Why not share the code :-)

haja-fgabriel commented 3 months ago

I will recommend another workaround until the issue is fixed in Visual Studio:

What I would rather recommend do is to make CPython avoid catching the breakpoint exception raised by the DebugBreak() function (so you can use it from your C extensions) and start the Python process (preferrably from your project's virtual environment) from WinDbg instead. But this will require recompiling CPython 😂

This is how it's currently behaving unfortunately:

image

Yes, debugging the Python code will be a bit more complicated instead, but honestly, using the standard pdb library is quite easy from the console.