-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Detect Corrupt Solution File in Dotnet Sln Add #28811
Detect Corrupt Solution File in Dotnet Sln Add #28811
Conversation
Just curious, MSBuild has its own solution parser code, is there any relationship/sharing? |
I don't think this code is shared by MSBuild, I couldn't find something like it. And I think this code is basically doing what Mono does. That's a good question though. cc @rainersigwald to potentially add his thoughts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious, MSBuild has its own solution parser code, is there any relationship/sharing?
I don't think this code is shared by MSBuild, I couldn't find something like it. And I think this code is basically doing what Mono does. That's a good question though.
This is how MSBuild tolerates projects malformed in this specific way:
The MSBuild SolutionFile
object is read-only so probably not useful as-is to the CLI, since you'll want to mutate the solution.
It is of course unfortunate that we have this duplication all over everything. I'd really like a public, open-source solution API from the Visual Studio team, but that's low on their priority list at the moment.
@baronfel PTAL at the error again when available, Marc wanted your approval before signing off on this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry aout the delay! Message reads well and is actionable 👍
Resolves #28155 (comment), see for more context.
A solution file can contain solution folders which aren't actually on disk and are just a solution file construct. These folders are written via child -> parent hashtable mappings in a preSolution configuration. During manual editing, merge conflicts, and or external editors, these mappings may become invalid. At the same time, solution project folders may mistakenly not include
EndProject
tags. Visual Studio accounts for these invalid files and lets the user get away with it, and upon saving can repair the solution file. For us and Mono, we more strictly enforce the file format and this adds an error to describe what's wrong with the file and how to fix it.Before:
After: