Skip to content

Fix infinite loop in Repl#5882

Merged
leculver merged 4 commits into
dotnet:mainfrom
leculver:createdump-infinite
Jun 17, 2026
Merged

Fix infinite loop in Repl#5882
leculver merged 4 commits into
dotnet:mainfrom
leculver:createdump-infinite

Conversation

@leculver

Copy link
Copy Markdown
Contributor

Using ReadLine + IsNullOrEmpty + continue:

string line = Console.ReadLine();
if (string.IsNullOrEmpty(line))
    continue;

Produces an infinite loop if stdin was closed. For example, running under an llm and it closes the pipe to the tool.

Copilot AI review requested due to automatic review settings June 16, 2026 19:49
@leculver leculver requested a review from a team as a code owner June 16, 2026 19:49
@leculver leculver force-pushed the createdump-infinite branch from 3aee960 to fdff67c Compare June 16, 2026 19:50
@leculver leculver added bug Something isn't working dotnet-dump labels Jun 16, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes an infinite loop in the REPL’s redirected-input mode by distinguishing EOF (Console.ReadLine() returning null) from an empty line (""). This addresses scenarios where the parent process closes stdin (e.g., when a driving process/LLM closes the pipe), causing ReadLine() to repeatedly return null.

Changes:

  • Add an explicit line == null (EOF) check when input is redirected, and exit the input loop.
  • Replace string.IsNullOrEmpty(line) with separate handling for EOF vs empty string.
Show a summary per file
File Description
src/Microsoft.Diagnostics.Repl/ConsoleService.cs Prevents an infinite loop on redirected stdin EOF by breaking out of the REPL read loop.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 1/1 changed files
  • Comments generated: 1

Comment thread src/Microsoft.Diagnostics.Repl/ConsoleService.cs
leculver and others added 2 commits June 16, 2026 16:00
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@leculver leculver enabled auto-merge (squash) June 16, 2026 20:04
@leculver leculver merged commit 2efd600 into dotnet:main Jun 17, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working dotnet-dump

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants