microsoft / microsoft/vs-solutionpersistence
Project configuration mappings are deleted when its GUID collides with another project's derived default ID
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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