.NET Diagnostic Output for WinForms

Debug and Trace output are two useful components in System.Diagnostic to immediate report on application status and information during run-time in WinForms application.

DiagnosticsTextBox is a WinForms control derived from TextBox created to display Debug and Trace output which works with multi-threaded applications. The framework of DiagnosticsTextBox is described in this post: Diagnostics TextBox


No manual configuration required, just drag and drop the DiagnosticsTextBox from CodeArtEng.Diagnostics.dll to your WinForm application, it will start capture traces once your application is start.

What's New

  • File writer split from DiagnosticsTextBox as standalone class, named as TraceFileWriter.
  • Introduced buffer control in DiagnosticsTextBox to limit memory consumption.


TraceFileWriter is created as stand-alone file writer which output traces to selected file. This is a standalone class which is also used by DiagnosticsTextBox to output traces to file.

The TraceFileWriter class is designed to handle log writing to network path with backup mechanism to store traces in local drive during network interruption. Merging between the backup path and the target log file will be trigger automatically when connection to network is re-established. Thus, minimized data loses due to network interruption.

Both DiagnosticsTextBox and TraceFileWriter listen to TraceLogger for incoming traces.


Memory Management

Continuous dumping thousands of lines into a TextBox components will definitely consume lot's of memory. With memory management installed on DiagnosticsTextBox , you can define numbers of line to show from property DisplayBufferSize. Of course, you can still have a choice to capture and show all traces by setting the value of this property to "0" which is the default value.

Popular posts from this blog

C# DSP Simulation - DSP Lab

C# DSP Toolbox: Digital Filters (Updated)