Description
- In Linux, output of console gets messed up after abrupt exit, if application has called Console.GetCursorPosition.
- Reproduce: Create a console app that is calling Console.GetCursorPosition and then waits in a loop. Start application with "dotnet run", and then break the application using Ctrl+C.
- After the .net/c# application has quit, text output in terminal gets disabled.
Configuration
- Using dotnet 6.0.400.
- Native Kubuntu 22.04 and Docker (mcr.microsoft.com/dotnet/sdk) on both Macos and Linux.
- Architecture x64 and arm64.
- Appear to be specific to linux, b/c it works well on native terminals in Macos (arm64).
Regression
Haven't tested with older dotnet versions than 6.0, but 6.0.200 has the same problem.
Example application (that disables console output after Ctrl+C)
class Program
{
public static void Main()
{
var pos = System.Console.GetCursorPosition();
while (true) { }
}
}
Another example application (that also disables console output after exit)
class Program
{
public static void Main()
{
var pos = System.Console.GetCursorPosition();
System.Environment.FailFast(string.Empty);
}
}
Project file
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
</Project>
Description
Configuration
Regression
Haven't tested with older dotnet versions than 6.0, but 6.0.200 has the same problem.
Example application (that disables console output after Ctrl+C)
Another example application (that also disables console output after exit)
Project file