Limit Dev18 Python profiling to Python 3.12-3.14 - #8598
Merged
StellaHuang95 merged 2 commits intoJul 30, 2026
Conversation
Remove the legacy etwtrace payload and reject unsupported interpreters before Diagnostics Hub starts a session. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 8b082fe2-2f94-4c5d-82a7-ea7b5a3284ef
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR narrows Dev18 Python profiling support to Python 3.12–3.14 to avoid shipping an etwtrace legacy payload whose native binaries fail Visual Studio insertion symbol policy, and to make unsupported interpreter scenarios fail early with clear messaging.
Changes:
- Removes
etwtrace 0.1b8restore +etwtrace_legacyVSIX payload and related bootstrap compatibility logic. - Adds a pre-launch interpreter version probe in the profiling command service, showing actionable localized messages for unreadable/unsupported interpreters.
- Updates the Python bootstrap (
diaghub_profile.py) and build restore script to enforce/align the supported version range (3.12–3.14).
Show a summary per file
| File | Description |
|---|---|
| Python/Product/Profiling/Strings.resx | Adds localized strings for interpreter-version-unavailable and unsupported-version messaging. |
| Python/Product/Profiling/Strings.Designer.cs | Updates generated resource accessors for the new strings. |
| Python/Product/Profiling/Profiling/PythonProfilerCommandService.cs | Probes interpreter version before returning Diagnostics Hub launch args; blocks unsupported/unreadable interpreters. |
| Python/Product/Profiling/Profiling.csproj | Stops packaging etwtrace_legacy content into the profiling VSIX. |
| Python/Product/Profiling/diaghub_profile.py | Removes legacy collector path and restricts runtime support to Python 3.12–3.14. |
| Build/PreBuild.ps1 | Removes legacy etwtrace restore and installs only the supported etwtrace payload. |
Review details
Files not reviewed (1)
- Python/Product/Profiling/Strings.Designer.cs: Generated file
- Files reviewed: 5/6 changed files
- Comments generated: 1
- Review effort level: Low
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Contributor
Author
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
Contributor
There was a problem hiding this comment.
Review details
Files not reviewed (1)
- Python/Product/Profiling/Strings.Designer.cs: Generated file
Comments suppressed due to low confidence (1)
Python/Product/Profiling/diaghub_profile.py:16
- Changing the supported range to 3.12–3.14 will break the existing bootstrap tests:
Python/Tests/ProfilingTests/ProfilingTests.cscurrently prefersPythonPaths.Python39_x64/Python39anddiaghub_profile_tests.py::test_supported_versionsasserts that (3,9) is supported. With_is_supported_versionnow requiring >= 3.12, these tests will start failing unless they’re updated to use 3.12+ and adjust the assertions.
def _is_supported_version(version):
return (3, 12) <= tuple(version[:2]) <= (3, 14)
- Files reviewed: 5/6 changed files
- Comments generated: 0 new
- Review effort level: Low
bschnurr
reviewed
Jul 30, 2026
| if not _is_supported_version(sys.version_info): | ||
| print( | ||
| "Visual Studio Python profiling supports Python 3.9 through 3.14.", | ||
| "Visual Studio Python profiling supports Python 3.12 through 3.14.", |
Contributor
Author
There was a problem hiding this comment.
Its printed message is a fallback diagnostic. The normal user-facing unsupported-version message does come from PTVS before the session starts and uses localized Strings.resx.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Context
Python profiling is currently unavailable in Dev18 because the legacy PTVS path depends on
VSPerfMon.exeandVSPerfCmd.exe, which are no longer shipped. #8591 began an exploratory effort to make profiling work again by routing PTVS through the Diagnostics Hub Python target andmicrosoft/python-etwtrace.This is exploratory enablement rather than a regression in a working Dev18 user scenario. We have no known user complaints about Dev18 Python profiling, and the feature was already broken before this work. The priority is therefore to establish a reliable, supportable path for current Python versions rather than restore every historical interpreter at substantially higher release and compliance cost.
Why PTVS originally included two etwtrace versions
etwtracecontains native.pydextensions compiled for specific CPython ABIs. Acp312extension cannot load into Python 3.11, for example.etwtrace 0.1b8is the last release that contains wheels for Python 3.9, 3.10, and 3.11. PTVS installed it into a separateetwtrace_legacydirectory and used extra collector-loading compatibility code for those interpreters.etwtrace 0.1b9contains the current Python 3.12, 3.13, and 3.14 wheels and is the payload used by the new Diagnostics Hub path.The bootstrap selected the legacy directory for Python 3.9-3.11 and the current directory for Python 3.12-3.14.
Why the insertion failed
The Dev18 insertion SymbolCheck found 24 newly introduced native binaries under
etwtrace_legacy:etwtrace 0.1b8Windows wheels were merged into the legacy payload._etwtrace,_etwinstrument, and_vsinstrument..pydfiles are not archived on MSDL.As a result, the PTVS build and release could succeed while the Visual Studio insertion correctly failed its symbol policy. This is not a transient policy issue or a portable-PDB false positive; the exact Windows PDBs required by the shipped binaries are unavailable to the insertion.
What would be required to keep Python 3.9-3.11 profiling
Adding
*.pydto PTVS's symbol publishing list is not sufficient because the matching PDBs are absent. A compliant legacy payload would require one of the following:0.1b8wheels and archive each matching.pyd/PDB pair to MSDL.etwtracerelease from the0.1b8line:.pyd.0.1b8.That is primarily a producer/release-pipeline investment, not a small PTVS packaging fix. It also preserves a second native payload and compatibility path indefinitely.
Changes
etwtrace 0.1b8restore and theetwtrace_legacyVSIX payload.etwtrace 0.1b9for Python 3.12-3.14.diaghub_profile.py.Why this is the best fix for the exploratory item
.diagsession.User impact
Manual validation
etwtracebinaries and noetwtrace_legacyentries.