From: Hyungju Lee Date: Wed, 14 Sep 2022 22:08:38 +0000 (+0900) Subject: Check CursorTop before changing CursorLeft to prevent ArgumentOutOfRangeException... X-Git-Tag: accepted/tizen/unified/riscv/20231226.055542~51^2~1^2~21 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e4d0818c71d674f2420c595c9b5c1ff120b2f3f7;p=platform%2Fcore%2Fdotnet%2Fdiagnostics.git Check CursorTop before changing CursorLeft to prevent ArgumentOutOfRangeException (#3372) * Catch ArgumentOutOfRangeException dotnet-dump analyze causes an Exception when console top is -1 * Check CursorTop before changing CursorLeft --- diff --git a/src/Microsoft.Diagnostics.Repl/ConsoleService.cs b/src/Microsoft.Diagnostics.Repl/ConsoleService.cs index c14fba57b..bb139a000 100644 --- a/src/Microsoft.Diagnostics.Repl/ConsoleService.cs +++ b/src/Microsoft.Diagnostics.Repl/ConsoleService.cs @@ -267,7 +267,7 @@ namespace Microsoft.Diagnostics.Repl Console.Write(m_clearLine); - if (!m_outputRedirected) { + if (!m_outputRedirected && Console.CursorTop >= 0 ) { Console.CursorLeft = 0; } } @@ -313,7 +313,7 @@ namespace Microsoft.Diagnostics.Repl Console.Write("{0}{1}", prompt, text); - if (!m_outputRedirected) { + if (!m_outputRedirected && Console.CursorTop >= 0) { Console.CursorLeft = prompt.Length + (m_cursorPosition - m_scrollPosition); } }