Fix portable PDB debug reservation after path mapping - #20509
Open
michaelglass wants to merge 3 commits into
Open
Fix portable PDB debug reservation after path mapping#20509michaelglass wants to merge 3 commits into
michaelglass wants to merge 3 commits into
Conversation
Contributor
❗ Release notes requiredYou can open this PR in browser to add release notes: open in github.dev
|
michaelglass
added a commit
to michaelglass/fsharp
that referenced
this pull request
Sep 10, 2026
Author
|
@dotnet-policy-service agree |
michaelglass
force-pushed
the
fix/portable-pdb-pathmap-reservation
branch
from
September 10, 2026 10:44
c2fe907 to
d16961b
Compare
michaelglass
added a commit
to michaelglass/fsharp
that referenced
this pull request
Sep 10, 2026
This comment has been minimized.
This comment has been minimized.
T-Gro
reviewed
Sep 10, 2026
T-Gro
left a comment
Member
There was a problem hiding this comment.
🤖 🕵️ AI review — verify independently.
| yield "--target:library" | ||
| yield "--deterministic+" | ||
| yield $"--debug:{debugType}" | ||
| yield $"--pathmap:{workDir}={mappedRoot}" |
Member
There was a problem hiding this comment.
🤖 🕵️ All three cases fail with FS2028 when TEMP contains spaces because runFscProcess joins unquoted arguments.
$env:TEMP = Join-Path ([IO.Path]::GetTempPath()) 'with spaces'
$env:TMP = $env:TEMP
New-Item -ItemType Directory -Force $env:TEMP | Out-Null
dotnet test --project tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj -c Debug --no-build -p:BUILDING_USING_DOTNET=true -p:FSHARPCORE_USE_PACKAGE=false -- --filter-method '*Path mapping removes original PDB path length from the entire binary*'
T-Gro
self-requested a review
September 10, 2026 14:20
runToolProcess (behind runFscProcess / runFsiProcess) built the child command line with String.concat " ", so any argument containing a space was split into several arguments by the child's command-line parser. This surfaced on the .NET Framework test legs, where the default references passed via CompilerAssert.DefaultProjectOptions live under "C:\Program Files (x86)\Reference Assemblies\...". fsc saw "C:\Program" and "Files" as separate tokens and failed with error FS2020: The assembly 'Assemblies\Microsoft\Framework\ .NETFramework\v4.7.2\Microsoft.CSharp.dll' is listed on the command line. Assemblies should be referenced using a command line flag such as '-r'. The same splitting applies to any test whose paths come from a temp directory containing spaces. Quote arguments that contain whitespace. Arguments without whitespace are passed through unchanged, so existing callers are unaffected. The determinism test now builds under a temp root containing a space so the behaviour stays covered.
michaelglass
force-pushed
the
fix/portable-pdb-pathmap-reservation
branch
from
September 10, 2026 15:11
03eda14 to
e16b51c
Compare
Contributor
|
🔍 Tooling Safety Check — Affects-Compiler-Output, Affects-Test-Tooling
|
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.
Description
--pathmapdoesn't make portable-PDB output path-independent. Compiling identical source from twodirectories whose paths differ in length, with
--deterministic+and both mapped to the same root,produces different DLLs. Measured on a real repo: PDBs byte-identical, 55 DLL bytes differ.
Cause: in
writeBinaryAux(ilwrite.fs) the debug-directory chunk is reserved from the originalpdb path (
Unicode.GetByteCount f + 40slack), but the bytes written are the mapped path. Thereservation — and the 4-byte-aligned layout after it — tracks a path that never appears in the output.
Fix: for portable PDBs reserve exactly what CodeView writes — 24-byte header + mapped path as UTF-8
bug 748444slack) isdeliberately unchanged; embedded PDBs reserve from the file name.
Checklist