.NET 8.0 AOT DebugView

.NET 8.0 AOT DebugView

Debugview is an application that allows you to monitor debug output on your local system or any computer on a network accessible via TCP/IP.

最后更新 8/29/2023 1:44 PM
JusterZhu
预计阅读 2 分钟
分类
.NET
专题
C# AOT
标签
.NET C# AOT

1. summary

Debugging and log output cannot be avoided during the development process. Applications that use Trace objects can be traced in real time regardless of whether they are running in debug mode or release mode (vs. debugview cannot be monitored when running the program, just double-click exe to run monitoring). By the way, let's test the debugging information output by Trace.Write based on AOT release and application release in normal mode in. NET8.

2. Debugview

Debugview is an application that allows you to monitor debug output on your local system or any computer on a network accessible via TCP/IP. It can display both kernel mode and Win32 debug output, so there is no need for a debugger to capture debug output generated by applications or device drivers, or to modify applications or drivers to use non-standard debug output APIs.

It's very simple to use. Just check these items in Options after starting as an administrator (the output message content will be automatically captured when the. NET program we write runs).

3. test code

using System.Diagnostics;

namespace TraceAOT
{
   internal class Program
  {
       static void Main(string[] args)
      {
           //指定Trace输出的日志文件名
           Trace.Listeners.Add(new TextWriterTraceListener("MyTraceListeners"));
           for (int i = 0; i < 10; i++)
          {
               Thread.Sleep(1000);
               //在满足前面的表达式时输出,Trace信息。(同时也向Listeners添加信息。)
               Trace.WriteLineIf(i==5, "Trace message.");
          }
           //Flush完成本次输出
           Trace.Flush();
           Console.WriteLine("OK");
           Console.Read();
      }
  }
}

4. test results

5. conclusion

The DebugView tool can be used normally in applications based on. NET 8, whether it is AOT or ordinary release. The Trace object can perform real-time tracing regardless of whether programs running in debug mode or release mode, which greatly simplifies our tracing and debugging process.

Keep Exploring

延伸阅读

更多文章
同分类 / 同专题 2/7/2026

Summary of experience in using AOT

From the very beginning of project creation, you should develop a good habit of conducting AOT release testing in a timely manner whenever new features are added or newer syntax is used.

继续阅读