Skip to content

Fix dotnet format failure to handle slnx files #47508

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 10, 2025

Conversation

sharwell
Copy link
Contributor

@sharwell sharwell commented Mar 12, 2025

This is a follow-up to #45442.

Currently dotnet format throws an exception instead of completing when a user explicitly specifies a .slnx-format solution file to format. The previous work in #45442 to add support for this format only covered the case where a directory was specified. Customers who prefer to be explicit, and/or customers that have more than one solution file in the same folder, will not be able to use dotnet format to format a .slnx solution without this fix.

This is not a regression, but rather completes the implementation behavior intended to be included in this release with the earlier pull request.

The risk involved in this change is very low.

Fixes #47038

@Copilot Copilot AI review requested due to automatic review settings March 12, 2025 15:43
@sharwell sharwell requested a review from a team as a code owner March 12, 2025 15:43
@ghost ghost added Area-NetSDK untriaged Request triage from a team member labels Mar 12, 2025
@sharwell sharwell changed the base branch from main to release/9.0.2xx March 12, 2025 15:44
Copy link
Contributor

@Copilot 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 fixes an issue where dotnet-format failed to handle .slnx files by updating the condition that determines if a file is a solution file.

  • Updated the solution file extension check in MSBuildWorkspaceFinder.cs
  • Added support for .slnx file extensions
Comments suppressed due to low confidence (1)

src/BuiltInTools/dotnet-format/Workspaces/MSBuildWorkspaceFinder.cs:60

  • Consider adding test cases to verify that the new .slnx extension is correctly identified as a solution file.
|| workspaceExtension.Equals(".slnx", StringComparison.OrdinalIgnoreCase);

Copy link
Contributor

@edvilme edvilme left a comment

Choose a reason for hiding this comment

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

Thanks for the fix!
Looks good to me, we weren't sure if it was already supported by your command :)

@baronfel
Copy link
Member

We'll need the tactics template and stuff to get approval here.

@kasperk81
Copy link
Contributor

@baronfel the other two places missing slnx handling #40913 (comment)

@edvilme
Copy link
Contributor

edvilme commented Mar 13, 2025

We'll need the tactics template and stuff to get approval here.

Hello @sharwell sice you have a bit more context, could you please help us out with the template and email? Thx!

@edvilme
Copy link
Contributor

edvilme commented Mar 14, 2025

Added "DO NOT MERGE" to avoid accidental merges after rerunning tests :)

@Forgind
Copy link
Contributor

Forgind commented Mar 27, 2025

@sharwell, did you intend to add servicing-consider?

@virzak
Copy link

virzak commented Apr 2, 2025

Would really like to have this plz

@Forgind Forgind removed untriaged Request triage from a team member Branch Lockdown labels Apr 2, 2025
@kasperk81
Copy link
Contributor

could you please help us out with the template and email?

can someone else fill the template if op isn't available for three weeks? pr description has the clear context: not a regression, rather it's for slnx support feature completion released in 9.0.100

@Forgind
Copy link
Contributor

Forgind commented Apr 3, 2025

could you please help us out with the template and email?

can someone else fill the template if op isn't available for three weeks? pr description has the clear context: not a regression, rather it's for slnx support feature completion released in 9.0.100

I can probably just add servicing-consider; it doesn't look like a risky PR to me. My only concern is that since I'm not fully aware of the impact of the change, I'm not sure I could make a good case for it if there's any pushback.

@Forgind
Copy link
Contributor

Forgind commented Apr 3, 2025

could you please help us out with the template and email?

can someone else fill the template if op isn't available for three weeks? pr description has the clear context: not a regression, rather it's for slnx support feature completion released in 9.0.100

I can probably just add servicing-consider; it doesn't look like a risky PR to me. My only concern is that since I'm not fully aware of the impact of the change, I'm not sure I could make a good case for it if there's any pushback.

I was told to not do this so unmarking it. @sharwell?

@sailro
Copy link

sailro commented Apr 9, 2025

Hello there.

I really hope this will be merged very soon. It's really extremely annoying for those who use dotnet format as precommit and who have already switched to slnx format.

Thanks!

@WeihanLi
Copy link
Contributor

WeihanLi commented Apr 9, 2025

any release plan for this fix?

@marcpopMSFT
Copy link
Member

This will be discussed tomorrow in tactics for inclusion in May servicing.

@leecow leecow modified the milestones: 9.0.3xx, 9.0.2xx Apr 10, 2025
@sharwell sharwell merged commit 75e50e2 into dotnet:release/9.0.2xx Apr 10, 2025
33 of 42 checks passed
@sharwell sharwell deleted the format-slnx branch April 10, 2025 17:27
vancodocton added a commit to vancodocton/MoneyGroup that referenced this pull request Apr 17, 2025
oliverbooth added a commit to oliverbooth/X10D that referenced this pull request Apr 20, 2025
dotnet/sdk#40913 and dotnet/sdk#47508 have been merged, and the .sln file is no longer required for CI/CD.

Hello SDK-style solutions!
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.

dotnet format in SDK 9.0.200 throws FileNotFoundException for .slnx solutions