Skip to content

Update RunCommand to write launch settings messages to stderr for MCP#53170

Open
Luiz-Ossinho wants to merge 2 commits intodotnet:mainfrom
Luiz-Ossinho:issue/45640
Open

Update RunCommand to write launch settings messages to stderr for MCP#53170
Luiz-Ossinho wants to merge 2 commits intodotnet:mainfrom
Luiz-Ossinho:issue/45640

Conversation

@Luiz-Ossinho
Copy link

@Luiz-Ossinho Luiz-Ossinho commented Feb 26, 2026

Reasoning behind the issue

  • MCP guides often redirect logs to stderr so stdout stays “clean” for the protocol messages.
  • The dotnet run command outputs launchSettings.json usage messages to stdout, which the MCP server reads as incoming messages.
  • Unfortunately, the current RunCommand.cs prints Reporter.Output.WriteLine unconditionally to stdout; the user can’t easily redirect this via dotnet run without code changes.

The TryGetLaunchProfileSettingsIfNeeded method prints a message like:

Using launch settings from C:\path\to\Properties\launchSettings.json

directly via:

// RunCommand.cs, line 469
Reporter.Output.WriteLine(string.Format(CliCommandStrings.UsingLaunchSettingsFromMessage, launchSettingsPath));

If the project logs are being sent to stdout, VS Code (or any LSP client) can interpret that as a protocol message. MCP servers expect JSON-RPC messages on stdout, so any other output (like this “Using launch settings from …”) is considered a malformed message, triggering:

Failed to parse message: "Using launch settings from ...\Properties\launchSettings.json..."

This is only a warning — the server still works, but the message pollutes the LSP/JSON-RPC stream.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant