From 897c9c5fcbe2efa0f73d7915a56d64b546463bbd Mon Sep 17 00:00:00 2001 From: Tichau Date: Wed, 7 Sep 2016 08:05:01 +0200 Subject: [PATCH] Improve diagnostics data naming --- Application/FileConverter/Diagnostics/Debug.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Application/FileConverter/Diagnostics/Debug.cs b/Application/FileConverter/Diagnostics/Debug.cs index 2eb8fdf..350999c 100644 --- a/Application/FileConverter/Diagnostics/Debug.cs +++ b/Application/FileConverter/Diagnostics/Debug.cs @@ -5,9 +5,9 @@ namespace FileConverter.Diagnostics using System; using System.Collections.Generic; using System.ComponentModel; - using System.Diagnostics; using System.IO; using System.Linq; + using System.Threading; using System.Windows; public static class Debug @@ -54,12 +54,14 @@ namespace FileConverter.Diagnostics { DiagnosticsData diagnosticsData; - int threadId = System.Threading.Thread.CurrentThread.ManagedThreadId; + Thread currentThread = System.Threading.Thread.CurrentThread; + int threadId = currentThread.ManagedThreadId; lock (Debug.diagnosticsDataById) { if (!Debug.diagnosticsDataById.TryGetValue(threadId, out diagnosticsData)) { - diagnosticsData = new DiagnosticsData(Debug.threadCount > 0 ? string.Format("Thread {0}", Debug.threadCount) : "Application"); + string threadName = Debug.threadCount > 0 ? $"{currentThread.Name} ({Debug.threadCount})" : "Application"; + diagnosticsData = new DiagnosticsData(threadName); diagnosticsData.Initialize(Debug.diagnosticsFolderPath, threadId); Debug.diagnosticsDataById.Add(threadId, diagnosticsData); Debug.threadCount++;