Skip to content

Conversation

@michaelnebel
Copy link
Contributor

@michaelnebelmichaelnebel 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

@michaelnebelmichaelnebel changed the title C#: Support .slnx.C#: Support .slnx. solution files.Dec 12, 2025
@michaelnebelmichaelnebel marked this pull request as ready for review December 12, 2025 09:18
@michaelnebelmichaelnebel requested review from a team as code ownersDecember 12, 2025 09:18
CopilotAI review requested due to automatic review settings December 12, 2025 09:18
@michaelnebelmichaelnebel requested a review from a team as a code ownerDecember 12, 2025 09:18
Copy link
Contributor

CopilotAI 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
FileDescription
docs/codeql/reusables/supported-versions-compilers.rstAdded .slnx to the list of supported file extensions for C#
csharp/ql/lib/change-notes/2025-12-11-slnx-support.mdAdded change note documenting the new feature
csharp/ql/integration-tests/posix/standalone_dependencies_executing_runtime/Assemblies.expectedUpdated 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.bzlUpdated package versions and added Microsoft.VisualStudio.SolutionPersistence dependency
csharp/paket.lockUpdated lock file with new package versions
csharp/paket.dependenciesAdded Microsoft.VisualStudio.SolutionPersistence package reference
csharp/extractor/Semmle.Util/Language.csEnhanced Language class to support solution-specific extensions; refactored constructors with parameter reordering
csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/paket.referencesAdded SolutionPersistence package reference
csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/SolutionFile.csUpdated comments to mention .slnx support
csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/FileProvider.csExtended solution file search to include .slnx extension
csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/BUILD.bazelAdded SolutionPersistence dependency
csharp/autobuilder/Semmle.Autobuild.Shared/paket.referencesAdded SolutionPersistence package reference
csharp/autobuilder/Semmle.Autobuild.Shared/Solution.csUpdated comments to mention .slnx support
csharp/autobuilder/Semmle.Autobuild.Shared/BUILD.bazelAdded SolutionPersistence dependency
csharp/autobuilder/Semmle.Autobuild.Shared/Autobuilder.csAdded 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
privateLanguage(stringname,stringprojectExtension)
{
ProjectExtension=extension;
ProjectExtension=projectExtension;
UpperCaseName=name;
}
Copy link

CopilotAIDec 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
ContributorAuthor

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
ContributorAuthor

DCA looks good.

Sign up for freeto 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

@michaelnebel