Add the verbose output of the internal call to dotnet in dotnet-ef#37643
Add the verbose output of the internal call to dotnet in dotnet-ef#37643AndriySvyryd wants to merge 1 commit intomainfrom
dotnet in dotnet-ef#37643Conversation
There was a problem hiding this comment.
Pull request overview
This PR enhances dotnet-ef diagnostics by adding verbose logging around the internal dotnet msbuild invocation used to extract project metadata.
Changes:
- Add a new localized resource (
RunningCommand) for verbose command execution messages. - Emit verbose output for the
dotnet msbuildmetadata call inProject.FromFile, including the captured output. - Regenerate/update the
Resources.Designer.csto reflect.resxchanges.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/dotnet-ef/Properties/Resources.resx | Adds RunningCommand string resource (and reorders some existing entries). |
| src/dotnet-ef/Properties/Resources.Designer.cs | Updates strongly-typed resource accessors for the .resx changes. |
| src/dotnet-ef/Project.cs | Adds verbose logging for the internal dotnet call and its output during project metadata retrieval. |
Files not reviewed (1)
- src/dotnet-ef/Properties/Resources.Designer.cs: Language not supported
| Reporter.WriteVerbose(Resources.RunningCommand("dotnet " + string.Join(" ", args))); | ||
|
|
There was a problem hiding this comment.
Exe.Run already writes the executed command line to verbose output (and does correct quoting via Exe.ToArguments). The added RunningCommand("dotnet " + string.Join(" ", args)) duplicates that output and can be misleading for paths/args containing spaces since it doesn't quote/escape. Consider removing this line and instead passing processCommandLine to Exe.Run to wrap the already-formatted command string (or use Exe.ToArguments(args) when composing the message).
| Reporter.WriteVerbose(Resources.RunningCommand("dotnet " + string.Join(" ", args))); |
| Reporter.WriteVerbose(output.ToString()); | ||
|
|
||
| var metadata = JsonSerializer.Deserialize<ProjectMetadata>(output.ToString())!; |
There was a problem hiding this comment.
output.ToString() is called multiple times here (once for verbose logging and again for JSON deserialization), which allocates a new string each time. Consider materializing it once into a local variable and reusing it for both logging and JsonSerializer.Deserialize.
| Reporter.WriteVerbose(output.ToString()); | |
| var metadata = JsonSerializer.Deserialize<ProjectMetadata>(output.ToString())!; | |
| var outputString = output.ToString(); | |
| Reporter.WriteVerbose(outputString); | |
| var metadata = JsonSerializer.Deserialize<ProjectMetadata>(outputString)!; |
No description provided.