Is it possible that I call Thread.Sleep(1000) and the application may goto sleep for a very large amount of time like a minute or more?
It looks like that is happening in my application. I am using Thread.Sleep and the application seems to hang in the middle.
When I hit Ctrl+Alt+Break, it points to the line just before the Thread.Sleep call. If I try to watch any variable, it says the Thread is in sleep and the variable is not in scope.
EDIT:
public void Write(string command)
{
_port.WriteLine("\r");
_port.WriteLine(command + "\r");
Thread.Sleep(100);
}
The thread being in sleep doesn’t necessarily mean it’s literally inside Thread.Sleep; it just means that it’s blocked somewhere. In this case, it’s likely blocked inside your serial port write for some reason, potentially stemming from some deeper COM port issue from your topic here: C# COM port communication problem