Skip to content

Conversation

@michaelnebel
Copy link
Contributor

@michaelnebel michaelnebel commented Dec 11, 2025

In this PR we implement support for the .slnx file format - both for build-mode: none and autobuilder.

Even though it is discouraged to use SolutionFile.Parse (it is considered an internal implementation detail), it appears that parsing support for .slnx was introduced here. If we wan't to do it the supported way, we would basically need to copy the parsing implementation. IMO we should continue to use the exposed parsing functionality and only mirror the implementation in case it becomes deprecated.
We need to explicitly reference Microsoft.VisualStudio.SolutionPersistence for the new parsing to be applied.

This feature is now more crucial as .NET 10 uses the .slnx format as default, which is explained here

@github-actions github-actions bot added the C# label Dec 11, 2025
@michaelnebel michaelnebel changed the title C#: Support .slnx. C#: Support .slnx. solution files. Dec 12, 2025
@michaelnebel michaelnebel marked this pull request as ready for review December 12, 2025 09:18
@michaelnebel michaelnebel requested review from a team as code owners December 12, 2025 09:18
Copilot AI review requested due to automatic review settings December 12, 2025 09:18
@michaelnebel michaelnebel requested a review from a team as a code owner December 12, 2025 09:18
@michaelnebel michaelnebel requested a review from hvitved December 12, 2025 09:25
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for .slnx (XML-based solution) files in the C# CodeQL analysis for both build-mode: none and autobuilder scenarios. The implementation leverages the Microsoft.VisualStudio.SolutionPersistence NuGet package to parse .slnx files using the existing SolutionFile.Parse() API.

Key changes:

  • Added .slnx to supported file extensions in documentation
  • Created integration tests for both standalone and autobuilder scenarios with .slnx files
  • Updated dependency files to include Microsoft.VisualStudio.SolutionPersistence package

Reviewed changes

Copilot reviewed 31 out of 33 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
docs/codeql/reusables/supported-versions-compilers.rst Added .slnx to the list of supported file extensions for C#
csharp/ql/lib/change-notes/2025-12-11-slnx-support.md Added change note documenting the new feature
csharp/ql/integration-tests/posix/standalone_dependencies_executing_runtime/Assemblies.expected Updated expected assemblies to include the new SolutionPersistence DLL
csharp/ql/integration-tests/all-platforms/standalone_slnx/* New integration test suite for standalone extraction with .slnx files
csharp/ql/integration-tests/all-platforms/autobuild_slnx/* New integration test suite for autobuilder with .slnx files
csharp/paket.main.bzl Updated package versions and added Microsoft.VisualStudio.SolutionPersistence dependency
csharp/paket.lock Updated lock file with new package versions
csharp/paket.dependencies Added Microsoft.VisualStudio.SolutionPersistence package reference
csharp/extractor/Semmle.Util/Language.cs Enhanced Language class to support solution-specific extensions; refactored constructors with parameter reordering
csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/paket.references Added SolutionPersistence package reference
csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/SolutionFile.cs Updated comments to mention .slnx support
csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/FileProvider.cs Extended solution file search to include .slnx extension
csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/BUILD.bazel Added SolutionPersistence dependency
csharp/autobuilder/Semmle.Autobuild.Shared/paket.references Added SolutionPersistence package reference
csharp/autobuilder/Semmle.Autobuild.Shared/Solution.cs Updated comments to mention .slnx support
csharp/autobuilder/Semmle.Autobuild.Shared/BUILD.bazel Added SolutionPersistence dependency
csharp/autobuilder/Semmle.Autobuild.Shared/Autobuilder.cs Added logic to search for language-specific solution files (.slnx) in build priority

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +15 to 19
private Language(string name, string projectExtension)
{
ProjectExtension = extension;
ProjectExtension = projectExtension;
UpperCaseName = name;
}
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parameter order has been changed in the constructor, which could be a breaking change if this constructor is called from other places in the codebase. However, this appears to be intentional to make the API more readable with the name parameter first. Note that both constructors have their parameters swapped from (extension, name) to (name, extension).

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The constructors are private.

@michaelnebel
Copy link
Contributor Author

DCA looks good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant