SCSF. Chapter 1. E. Tracing and Visualization
One of the most important things that anyone can learn about a new piece of software is how to pick it apart and see what it is really doing. There are two main methods for doing that with CAB. The first, shown next, is with classic debugger tracing. The CAB libraries have been written to output debugger traces in strategic points. All you have to do is turn it on by making the entries shown below in your app.config file. The source name is the name of the class, such as the ModuleLoaderService shown here:
每个人从一份新的软件中可以学到的最重要的事情就是如何将它分离并且看到什么真正在运作。CAB有两个主要的方法去完成这件事情。第一,经典的debugger tracing.CAB库被编写为从战略角度输出debugger traces。所有你需要做的是通过在app.config文件中打开它,souce标签中的name谁能够就是类的名称。
<system.diagnostics>
<switches>
<add name="MySwitch1" value="all" />
</switches>
<sources>
<source
name="Microsoft.Practices.CompositeUI.Services.ModuleLoaderService"
switchName ="MySwitch1"/>
</sources>
</system.diagnostics>
The tracing shows up in the debugger's output window, as shown in Figure 1-10.
Figure 1-10. CAB code outputting traces in debug window.

The real whiz-bang tracing happens with a Visualizer, an unsupported utility tool specific to CAB. It is currently a separate download on GotDotNet.com, at http://codegallery.gotdotnet.com/cab. This tool is a DLL that you build and install in your application's root directory. You just make a few entries in the config file, and it runs.
The Visualizer is a superb standalone application that examines and displays the WorkItem hierarchy of a CAB application. When run with the Walkthrough sample, it looks like Figure 1-11.
Figure 1-11. Sample visualizer program provided with CAB.

In the figure, the Visualizer shows the root work item, in this case of class ShellWorkItem. Its properties appear in the window on the right side.

浙公网安备 33010602011771号