Skip to content
swax edited this page Aug 2, 2012 · 2 revisions

When you download and unzip Code Perspective, XBuilder.exe should be in the root folder. XBuilder is what recompiles your .Net assemblies with visualization support. This process is called XRaying.

Build Tab

Adding assemblies

The first step in adding visualization support to your app is selecting what exe and dll files you want to visualize. Multiple exe and dll files can be selected from the same directory and all will be 'XRayed' together. Use the Add link to add assemblies. The remove link will remove anything selected. The reset link will let you use a different source folder because after assemblies are added, only assemblies from the same folder can be added.

Picking Options

The tracking options are all on be default. The tracking options are more for debugging purposes - if there are problems with the XRayed app then turning off a certain tracking option may make it work.

Decompile to C# is off by default because it takes longer to recompile with it enabled.

Show viewer on Start is on by default, but you might want to turn it off if you want to embed the visualizer with your app and bring it up on demand for when you need to diagnose something. The Monitor tab is where you can bring up the Viewer for running XRayed apps.

Overwrite originals will overwrite the exe and dll files you selected with the XRayed versions and put the originals in the xBackup folder in the same directory as the original files. XRay renames the namespaces in your app during the recompile process so it can be run side-by-side with your program allowing it to use all the same configuration files etc.. because it's located in the same directory. Renaming the namespace though does not work with WPF apps because resources are located dynamically in the assembly with a Pack URI that is difficult to recompile correctly - that's why for wpf apps 'overwrite originals' needs to be checked for XRay to work.

Building

When you have your assemblies added, and options set, click the Recompile button. This will analyze the code in your app and add hooks in it for the visualizer. When the process is complete a file named XRay.MyApp.exe should be alongside your original assembly, along with the XLibrary.dll file, and XRay.dat file.

The Analyze button is for static analysis of your XRayed apps. This will visualize the content of the generated XRay.dat file. Supported views in this mode are the Tree Map and Dependency views.

The Launch button will start your recompiled app. If there are problems during startup then your options are to try selecting 'Overwrite Originals' or turning off the tracking options to see if that gets it to work. The recompile process in Code Perspective is complicated so it can't be guaranteed to work with everything 100%. Over time though with more testing and debugging, hopefully most issues will be identified.

Monitor Tab

The Monitor tab is where you'll see any running XRayed process on your system. The XLibrary dll that is linked to your recompiled assembly contains an IPC server that can be queried. Using this, even if the Code Perspective visualization is not active, it can be started up from the Monitor tab. It is also possible to show multiple viewers in case you want to see multiple aspects of your program at the same time.

Another option is to turn off tracking for your application. This option turns off all code tracking and results in minimal CPU usage by Code Perspective. This is useful in cases where you have a CPU intensive app and only want to bring in XRay overhead when needed.

Scanner Tab

This tab is for finding .Net assemblies in certain folders on your machine. In cases where you want to do reverse engineering on a program, it is useful to know which exe and dll files are .Net assemblies and can be used with Code Perspective.

About Tab

The about tab shows version and license information. By default Code Perspective is AGPL and programs recompiled should be open source as well because XLibrary is AGPL. To use Code Perspective with proprietary apps you should get the Pro version from codeperspective.com. When XBuilder.exe is started with a *.pro file in the root directory, then the About tab should show the license as 'Pro.' Programs you recompile with the Pro version of XBuilder will be automatically marked Pro as well, so you don't need to redistribute the .pro file.