SlnFileFactory.CreateFromFilteredSolutionFile: Refactor#46404
SlnFileFactory.CreateFromFilteredSolutionFile: Refactor#46404edvilme merged 4 commits intodotnet:release/9.0.3xxfrom
Conversation
| // Store the original solution path in the description field of the filtered solution | ||
| filteredSolution.Description = originalSolutionPathAbsolute; | ||
|
|
There was a problem hiding this comment.
In some areas it might be useful to keep a reference to the original solution file path. See #46392
The Description field is used to store manually entered user descriptions for solution files. This feature does not exist in .slnf schema, so it seems reasonable to describe a solution filter by its original solution file path.
Doing this also avoids having to parse the file twice to find this data.
There was a problem hiding this comment.
If Description doesn't exist in the .slnf schema, does that mean this value only exists in memory? If it isn't in the schema, it would never get written to disk. So, what is the purpose of setting it?
There was a problem hiding this comment.
Yes, at the moment this does not write to slnf files. However, it is useful having a field in the SolutionModel that stores metadata such as Description. For example, on
the file is parsed twice (once to get the projects, and a second time to get the original solution path). By storing this information in memory, this could be avoided.
We also wouldn't have to worry about overriding user-entered information as it is not part of the slnf file, but does describe it
MiYanni
left a comment
There was a problem hiding this comment.
Changes generally look good. One question on the Description. Also, are there tests that exercise this method? Just want to make sure the changes don't affect the logic.
| // Store the original solution path in the description field of the filtered solution | ||
| filteredSolution.Description = originalSolutionPathAbsolute; | ||
|
|
There was a problem hiding this comment.
If Description doesn't exist in the .slnf schema, does that mean this value only exists in memory? If it isn't in the schema, it would never get written to disk. So, what is the purpose of setting it?
Yes, a test for listing projects in a solution filter exists in |
Refactored to simplify code and improve readability