My program often stops with a dead end. When I take a break and look at the threads, I see that three threads are stuck in our logging function:
public class Logging { public static void WriteClientLog(LogLevel logLevel, string message) { #if DEBUG System.Diagnostics.Debug.WriteLine(String.Format("{0} {1}", DateTime.Now.ToString("HH:mm:ss"), message));
If I allow the program to continue, the threads still remain on this line.
I do not see where this can be blocked. The debug class, string class, and datetime class seem thread safe.
The error is removed when I delete the #if DEBUG System... #endif code, but I'm curious why this happens.
Insert one:
public void CleanCache() { Logging.WriteClientLog(LogLevel.Debug, "Start clean cache.");
Stream two:
private void AliveThread() { Logging.WriteClientLog(LogLevel.Debug, "Check connection");
Carra source share