PTVS
PTVS copied to clipboard
The option "Python/Native Debugging" is missing.
Environment
Steps to Reproduce
- Create new project: Visual C++ > Windows Desktop > Windows Console Application
- Open the property page
- Click Debugging tab
- Click to open the drop-down list
- Observes
Expected behavior
The option "Python/Native Debugging" should exist in the list.
Actual result
The option "Python/Native Debugging" is missing.
This must have been a bug on the C++ side of things, because it seems to be working for me now in VS 2022 Preview 6. @linette-zyy, can you verify that it's fixed?
@judej Note that if this is indeed fixed, we'll need to update the release notes to remove the item about it not being there.
Still missing for me on vs2022 preview update 7 , tried removing and adding back the Python native development tools
workload with no success in bringing the mixed mode debugger back.
Microsoft Visual Studio Community 2022 Preview
Version 17.0.0 Preview 7.0
VisualStudio.17.Preview/17.0.0-pre.7.0+31825.309
Microsoft .NET Framework
Version 4.8.04084
Installed Version: Community
Visual C++ 2022 00482-90000-00000-AA785
Microsoft Visual C++ 2022
ASP.NET and Web Tools 2019 17.0.786.62401
ASP.NET and Web Tools 2019
Azure App Service Tools v3.0.0 17.0.786.62401
Azure App Service Tools v3.0.0
C# Tools 4.0.0-6.21521.2+68d3c0e77ff8607adca62a883197a5637a596438
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
Cookiecutter 17.0.21293.2
Provides tools for finding, instantiating and customizing templates in cookiecutter format.
Linux Core Dump Debugging 1.0.9.31808
Enables debugging of Linux core dumps.
Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
Microsoft MI-Based Debugger 1.0
Provides support for connecting Visual Studio to MI compatible debuggers
Microsoft Visual C++ Wizards 1.0
Microsoft Visual C++ Wizards
Microsoft Visual Studio VC Package 1.0
Microsoft Visual Studio VC Package
NuGet Package Manager 6.0.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/
ProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio Extension Detailed Info
Python - Profiling support 17.0.21293.2
Profiling support for Python projects.
Python - VC Project Support 17.0.21153.2
Provides support for launching C++ projects with Python debugging enabled.
Python with Pylance 17.0.21293.2
Provides IntelliSense, projects, templates, debugging, interactive windows, and other support for Python developers.
Test Adapter for Boost.Test 1.0
Enables Visual Studio's testing tools with unit tests written for Boost.Test. The use terms and Third Party Notices are available in the extension installation directory.
Test Adapter for Google Test 1.0
Enables Visual Studio's testing tools with unit tests written for Google Test. The use terms and Third Party Notices are available in the extension installation directory.
TypeScript Tools 17.0.1001.2002
TypeScript Tools for Microsoft Visual Studio
Visual Basic Tools 4.0.0-6.21521.2+68d3c0e77ff8607adca62a883197a5637a596438
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual C++ for Linux Development 1.0.9.31808
Visual C++ for Linux Development
Visual F# Tools 17.0.0-beta.21519.2+727a6abda5bb3276f3e8dd918b721c5d21464aac
Microsoft Visual F# Tools
Visual Studio Code Debug Adapter Host Package 1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio
Visual Studio IntelliCode 2.2
AI-assisted development for Visual Studio.
Visual Studio Tools for CMake 1.0
Visual Studio Tools for CMake
I could repro on a clean VM with a fresh install of VS 2022.
It appears that we're installing Microsoft.PythonTools.Debugger.VCDebugLauncher.targets
in the wrong folder - it ends up under C:\Program Files\Microsoft Visual Studio\2022\Preview\Msbuild\Microsoft\VC\v160\Platforms\x64\ImportAfter
, but it should be under ...\VC\v170\...
.
Looking at our code, however, it does do the correct thing if you build locally, and has been doing that since @rchiodo fixed it in July. However, note that the build number for "Python - VC Project Support" in the package list above (17.0.21153.2) is not the same as for all other PTVS packages (17.0.21293.2). This is also what I'm seeing on my clean VM. Are we perhaps packaging an old .vsix for this component in VS?
@int19h something like this has happened before. See https://github.com/microsoft/PTVS/issues/5248 and https://github.com/microsoft/PTVS/issues/5275
Yup, sounds like it. Thank you, @huguesv!
@int19h This issue still reproduced on this environment Build of Visual Studio: 17.1.0 Preview 2.0 [31915.222.main] Build of Python Package: 17.0.21308.2 Is this build out of sync?
What is the version number that it gives for "Python - VC Project Support"?
Python - VC Project Support - 17.0.21153.2 This is version is not fixed.
I can confirm: moving the folder from C:\Program Files\Microsoft Visual Studio\2022\Preview\Msbuild\Microsoft\VC\v160\Platforms\x64\ImportAfter, to be under ...\VC\v170... solves the problem.
Thank you. That worked:
C:\Program Files\Microsoft Visual Studio\2022\Community\Msbuild\Microsoft\VC\v160\Platforms\x64\ImportAfter
To: C:\Program Files\Microsoft Visual Studio\2022\Community\Msbuild\Microsoft\VC\v170\Platforms\x64
Thank you! It worked for me in this method. But after hitting the breakpoint, the highlight is not displayed.
17.1.0 Preview 3.0 [32017.224.main]
Python install from Microsoft Store.
I can confirm: moving the folder from C:\Program Files\Microsoft Visual Studio\2022\Preview\Msbuild\Microsoft\VC\v160\Platforms\x64\ImportAfter, to be under ...\VC\v170... solves the problem.
I just want to mention that this issue still persists in non-preview vs 2022 17.1.6 and can still be fixed by just copying over the missing file.
I can still repro the issue with 17.2.6
I can still repro the issue with 17.2.6.
Copying the folder does not work for me.
I can still repro the issue with 17.2.6.
Copying the folder does not work for me.
Running VS Community 17.2.6. I copied .xaml file and folders from C:\Program Files\Microsoft Visual Studio\2022\Community\Msbuild\Microsoft\VC\v160\Platforms\x64\ImportAfter\ to the corresponding v170 location, and debugger appeared. Make sure you do the same with Win32 files.
Confirm this problems still exists in freshly updated and repaired Visual Studio Community 2022:
Microsoft Visual Studio Community 2022 (64-bit) - Current Version 17.3.5
Copying all folder content from v160 to v170 as described above enables the menu entry for the Python/Debugging option.
Having this issue in
Microsoft Visual Studio Professional 2022 (64-bit) - Current Version 17.3.6
Copying files also did not help
I have a similar issue but I can't find any ImportAfter
in my C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v160\Platforms\x64
folder. Is there any component that I might have missed? (I only want build and debug c++ code that starts from Python3.10, I've tried to create a minimum example here: https://github.com/axelande/simple_cpp_python_example)
{
"version": "1.0",
"components": [
"Microsoft.VisualStudio.Component.CoreEditor",
"Microsoft.VisualStudio.Workload.CoreEditor",
"Microsoft.Net.Component.4.8.SDK",
"Microsoft.VisualStudio.Component.Roslyn.Compiler",
"Microsoft.Component.MSBuild",
"Microsoft.VisualStudio.Component.Roslyn.LanguageServices",
"Microsoft.VisualStudio.Component.TextTemplating",
"Microsoft.VisualStudio.Component.NuGet",
"Microsoft.VisualStudio.Component.SQL.CLR",
"Microsoft.NetCore.Component.Runtime.6.0",
"Microsoft.NetCore.Component.SDK",
"Microsoft.VisualStudio.Component.AppInsights.Tools",
"Microsoft.VisualStudio.Component.DiagnosticTools",
"Microsoft.VisualStudio.Component.IntelliCode",
"Microsoft.Component.PythonTools",
"Microsoft.VisualStudio.Component.VC.CoreIde",
"Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
"Microsoft.VisualStudio.Component.Windows10SDK.19041",
"Microsoft.VisualStudio.Workload.Python",
"Microsoft.VisualStudio.ComponentGroup.MSIX.Packaging",
"Microsoft.ComponentGroup.Blend",
"Microsoft.VisualStudio.Component.VC.Tools.ARM64",
"Microsoft.VisualStudio.Component.UWP.VC.ARM64",
"Microsoft.VisualStudio.Component.VC.Tools.ARM",
"Microsoft.VisualStudio.ComponentGroup.UWP.VC",
"Microsoft.VisualStudio.Component.VC.Redist.14.Latest",
"Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core",
"Microsoft.VisualStudio.ComponentGroup.VC.Tools.142.x86.x64",
"Microsoft.VisualStudio.Component.VC.v141.x86.x64",
"Microsoft.VisualStudio.Workload.NativeDesktop",
"Microsoft.Component.NetFX.Native",
"Microsoft.VisualStudio.ComponentGroup.UWP.NetCoreAndStandard",
"Microsoft.VisualStudio.Component.Graphics",
"Microsoft.VisualStudio.ComponentGroup.UWP.Xamarin",
"Microsoft.VisualStudio.ComponentGroup.UWP.Support",
"Microsoft.VisualStudio.Workload.Universal",
"Microsoft.Net.Component.4.6.TargetingPack",
"Microsoft.VisualStudio.Component.VSSDK"
]
}
I have further profiled the problem and reproduced "Native/Python Debugging" not working after being brought back as suggested here. See https://github.com/microsoft/PTVS/issues/7260 for details.
I spoke with Pavel about this and it seems this is working locally but doesn't work when installing through VS setup. We need to investigate further.
See the following:
- https://github.com/microsoft/PTVS/issues/5248
- https://github.com/microsoft/PTVS/issues/5275
- https://github.com/microsoft/PTVS/pull/5276/files
Here's a great repro which uses Python 3.6, which means that python 3.10+ is not the cause of this.
- https://github.com/microsoft/PTVS/issues/7260
Ok I did some investigation and here's what I found:
- In the latest VS public preview (Version 17.6.0 Preview 1.0), the Python/Native Debugging option is missing.
- I checked to see if the targets file exists in the right place, and it DOES.
C:\Program Files\Microsoft Visual Studio\2022\PubPreview\MSBuild\Microsoft\VC\v170\Platforms\x64\ImportAfter\Microsoft.PythonTools.Debugger.VCDebugLauncher.targets
- I opened that targets file, and here's what I see:
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PropertyPageSchema Include="$(MSBuildThisFileDirectory)$(LangID)\Microsoft.PythonTools.Debugger.VCDebugLauncher.xaml" Condition="Exists('$(MSBuildThisFileDirectory)$(LangID)\Microsoft.PythonTools.Debugger.VCDebugLauncher.xaml')" />
<PropertyPageSchema Include="$(MSBuildThisFileDirectory)Microsoft.PythonTools.Debugger.VCDebugLauncher.xaml" Condition="!Exists('$(MSBuildThisFileDirectory)$(LangID)\Microsoft.PythonTools.Debugger.VCDebugLauncher.xaml')" />
</ItemGroup>
</Project>
So the file is looking for a language-specific xaml file in a $(LangID)
folder, and if that doesn't exist, it looks for Microsoft.PythonTools.Debugger.VCDebugLauncher.xaml
in the SAME directory as the targets file.
This xaml file does not exist, so the UI option is not present.
As a quick hack test, I checked the v160 path to see if the xaml file is there, and it is. So I copied that file to the v170 path and the option now shows up. SO it sounds like we have a hardcoded v160 install path somewhere in our build scripts. I will look into it and get it fixed.
This has been fixed but I'm not able to verify the fix locally until I get a VS installer from the PR into VS. That will probably happen tomorrow.
I tested this with the installer provided by the Visual Studio insertion PR, and the UI issue is indeed fixed in the installer:
So now I'm moving on to https://github.com/microsoft/PTVS/issues/7260
And the missing files are in the correct place after installing:
Glorious! thanks to all involved in fixing this!