[Tizen] Fix ArgumentOutOfRangeException accepted/tizen_7.0_unified_hotfix tizen_7.0_hotfix accepted/tizen/7.0/unified/20221110.060902 accepted/tizen/7.0/unified/hotfix/20221116.105303 accepted/tizen/unified/20220920.050138 tizen_7.0_m2_release
authorHyungju Lee <leee.lee@samsung.com>
Tue, 13 Sep 2022 05:09:12 +0000 (14:09 +0900)
committer이형주/Common Platform Lab(SR)/삼성전자 <leee.lee@samsung.com>
Tue, 13 Sep 2022 21:14:40 +0000 (06:14 +0900)
[root@localhost tmp]# dotnet dump analyze core_19700108_100550
Loading core dump: core_19700108_100550 ...
Ready to process analysis commands. Type 'help' to list available commands or 'help [command]' to get detailed help on a command.
Type 'quit' or 'exit' to exit the session.
Unhandled exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.ArgumentOutOfRangeException: The value must be greater than or equal to zero and less than the console's buffer size in that dimension. (Parameter 'top')
Actual value was -1.
   at System.Console.SetCursorPosition(Int32 left, Int32 top)
   at System.Console.set_CursorLeft(Int32 value)
   at Microsoft.Diagnostics.Repl.ConsoleProvider.ClearLine()
   at Microsoft.Diagnostics.Repl.ConsoleProvider.RefreshLine()
   at Microsoft.Diagnostics.Repl.ConsoleProvider.AppendNewText(String text)
   at Microsoft.Diagnostics.Repl.ConsoleProvider.ProcessKeyInfo(ConsoleKeyInfo keyInfo, Action`2 dispatchCommand)
   at Microsoft.Diagnostics.Repl.ConsoleProvider.Start(Action`2 dispatchCommand)
   at Microsoft.Diagnostics.Tools.Dump.Analyzer.Analyze(FileInfo dump_path, String[] command)
   --- End of inner exception stack trace ---

src/Microsoft.Diagnostics.Repl/Console/ConsoleProvider.cs

index c65d400b7102b83904f73557817a0577fc3089b9..b0dc675e21bb664996913e8cc5e16bcf4bf6bc24 100644 (file)
@@ -274,7 +274,7 @@ namespace Microsoft.Diagnostics.Repl
 
             Console.Write(m_clearLine);
 
-            if (!m_outputRedirected) {
+            if (!m_outputRedirected && Console.CursorTop >= 0) {
                 Console.CursorLeft = 0;
             }
         }
@@ -320,7 +320,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);
             }
         }
@@ -440,8 +440,6 @@ namespace Microsoft.Diagnostics.Repl
                         m_selectedHistory++;
                     }
                     SwitchToHistoryEntry();
-
-                    RefreshLine();
                     break;
 
                 default: