Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 2, 2025

The CreateFromFilteredSolutionFile method fails to parse solution filter files containing trailing commas or comments, despite MSBuild supporting both since dotnet/msbuild#6346.

Changes

  • SlnFileFactory.cs: Pass JsonDocumentOptions to JsonDocument.Parse() with AllowTrailingCommas = true and CommentHandling = JsonCommentHandling.Skip
  • Test coverage: Add TestAppWithTrailingCommaSlnf asset and tests validating both features work with dotnet solution list

Example

These .slnf files now parse correctly:

{
  // Filter for App projects only
  "solution": {
    "path": "App.sln",
    "projects": [
      "App\\App.csproj",
      "Lib\\Lib.csproj",  // trailing comma
    ]
  }
}
Original prompt

This section details on the original issue you should resolve

<issue_title>Revise CreateFromFilteredSolutionFile implementation for trailing comma (and allowing comments)</issue_title>
<issue_description>The current implementation of this method doesn't seem to allow trailing commas (and comments).

MSBuild supported trailing commas (and comments) of slnf files in dotnet/msbuild#6346

JsonElement root = JsonDocument.Parse(File.ReadAllText(filteredSolutionPath)).RootElement;

@baronfel @rainersigwald Another discrepancy due to not having a unified implementation/helper for how to parse solutions and solution filters. Not specific to test command this time :) </issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: marcpopMSFT <12663534+marcpopMSFT@users.noreply.github.com>
Copilot AI changed the title [WIP] Revise CreateFromFilteredSolutionFile for trailing commas and comments Support trailing commas and comments in .slnf files Dec 2, 2025
Copilot AI requested a review from marcpopMSFT December 2, 2025 01:28
Copilot finished work on behalf of marcpopMSFT December 2, 2025 01:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Revise CreateFromFilteredSolutionFile implementation for trailing comma (and allowing comments)

2 participants