You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just catch some strange bug with console on linux platform.
If I change Console.ForegroundColor, it leads to app freeze with 100% CPU load when I press ^C during read data from serial port.
When I remove setting of Console.ForegroundColor it works ok with no app freeze.
Also there is some bug with console color, because current Console.ForegroundColor is reported as White, while actual console text color is Gray.
Steps to Reproduce
In order to reproduce it, you're needs to connect some usb-serial adapter and put it's proper name in the code.
Create file test.cs:
using System;
using System.Linq;
using System.IO.Ports;
// Compile and run:
// $ mcs test.cs
// $ mono test.exe
class Program
{
static void Main(string[] args)
{
try
{
var foreColor = Console.ForegroundColor;
Console.WriteLine("foreColor: {0}", foreColor);
// BUG1: foreColor is White, while actual color is Gray
// BUG2: any attempt to change Console.ForegroundColor
// leads to app freeze with 100% CPU load if user
// pressing ^C during SerialPort.Read
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine("Yellow");
Console.ForegroundColor = foreColor;
Console.WriteLine("Normal");
Console.WriteLine("Now press Ctrl+C to get app freeze bug");
var serial = new SerialPort();
serial.PortName = "/dev/ttyUSB0";
serial.BaudRate = 38400;
serial.Parity = Parity.None;
serial.DataBits = 8;
serial.StopBits = StopBits.One;
serial.ReadTimeout = 100000;
serial.Open();
var data = new byte[4];
var read = serial.Read(data, 0, data.Length);
Console.WriteLine("Read() = {0}", read);
}
catch (Exception ex)
{
Console.WriteLine("{0}: {1}", ex.GetType().Name, ex.Message);
}
}
}
Compile it with command mcs test.cs
Run it with command mono test.exe
Expected result: it should show correct current console foreground color, which is Gray
Actual result: it shows ```foreColor: White - BUG 1
Press Ctrl+C to interrupt read operation from /dev/ttyUSB0 serial port
Expected result: application is terminated and console returns to user prompt
Actual result: application freeze with 100% CPU load - BUG 2
Current Behavior
Currently Console.ForegroundColor returns incorrect current console color (White instead of Gray).
Any attempt to set Console.ForegroundColor leads to app freeze when user pressing ^C during SerialPort.Read call.
Expected Behavior
Console.ForegroundColor should return correct current console color.
Set Console.ForegroundColor should not lead to app freeze when user pressing ^C during SerialPort.Read call.
On which platforms did you notice this
[ ] Linux
I reproduce it on Raspberry Pi OS Bookworm aarch64 and on Linux Mint on Intel x86-64 platform.
Version Used:
Mono JIT compiler version 6.12.0.200 (tarball Tue Jul 11 21:44:02 UTC 2023)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: normal
Notifications: epoll
Architecture: arm64
Disabled: none
Misc: softdebug
Interpreter: yes
LLVM: yes(610)
Suspend: preemptive
GC: sgen (concurrent by default)
Stacktrace
Debugger shows that the app freezes at __GI___poll at ./io/../sysdeps/unix/sysv/linux/poll.c:41,-1
The text was updated successfully, but these errors were encountered:
Just catch some strange bug with console on linux platform.
If I change Console.ForegroundColor, it leads to app freeze with 100% CPU load when I press ^C during read data from serial port.
When I remove setting of Console.ForegroundColor it works ok with no app freeze.
Also there is some bug with console color, because current Console.ForegroundColor is reported as White, while actual console text color is Gray.
Steps to Reproduce
In order to reproduce it, you're needs to connect some usb-serial adapter and put it's proper name in the code.
mcs test.cs
mono test.exe
Expected result: it should show correct current console foreground color, which is Gray
Actual result: it shows ```foreColor: White - BUG 1
Expected result: application is terminated and console returns to user prompt
Actual result: application freeze with 100% CPU load - BUG 2
Current Behavior
Currently Console.ForegroundColor returns incorrect current console color (White instead of Gray).
Any attempt to set Console.ForegroundColor leads to app freeze when user pressing ^C during SerialPort.Read call.
Expected Behavior
Console.ForegroundColor should return correct current console color.
Set Console.ForegroundColor should not lead to app freeze when user pressing ^C during SerialPort.Read call.
On which platforms did you notice this
[ ] Linux
I reproduce it on Raspberry Pi OS Bookworm aarch64 and on Linux Mint on Intel x86-64 platform.
Version Used:
Stacktrace
Debugger shows that the app freezes at __GI___poll at ./io/../sysdeps/unix/sysv/linux/poll.c:41,-1
The text was updated successfully, but these errors were encountered: