microsoft / microsoft/vs-solutionpersistence

Project configuration mappings are deleted when its GUID collides with another project's derived default ID

Open
#154 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
213
Forks
14
PR merge metrics
No merged PRs in 30d

Description

I was trying to run dotnet sln add XXX but it kept removing some unrelated project's configuration mappings.
Eventually, I realized it was a project that had been renamed but kept the same GUID, and another project had been added afterwards with the same original name. Claude told me this was right repo to file this, please transfer if not.

mkdir /tmp/repro && cd /tmp/repro
dotnet new sln -n repro --format sln
dotnet new classlib -o A
dotnet new classlib -o B
dotnet new classlib -o C
dotnet sln repro.sln add A B

# Give A the ID that the library deterministically derives for B's path:
#   {A0D7AA22-6627-6F78-C192-AD4CA0D6A2C6} == SHA256("B/B.csproj")[0..16]
# (I guess this was what VS did when adding the project to the sln, dotnet sln add seems to use a random GUID.)
OLD=$(grep '= "A",' repro.sln | grep -oP '(?<=csproj", "\{)[0-9A-F-]+')
sed -i "s/$OLD/A0D7AA22-6627-6F78-C192-AD4CA0D6A2C6/g" repro.sln

grep -c A0D7AA22 repro.sln    # 13  (1 project line + 12 config lines)
dotnet sln repro.sln add C    # exit 0, no warning
grep -c A0D7AA22 repro.sln    # 1   <-- A's 12 config lines silently deleted

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the provided repro with repro.sln and the dotnet sln add C command, then inspect how the A, B, and C project entries and configuration mappings are represented. Trace the solution persistence path used by dotnet sln add. Done means adding C no longer removes A's 12 configuration mappings, with the repro preserving all 13 occurrences of A's GUID.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
build-system, devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.