Wednesday, September 9, 2015

DebugView & iLogic

I feel as if I've done you all a horrible disservice.  I've been using an amazing tool for the past year or so and haven't shared it with you.

DebugView is a tool that will allow you to write out variables, parameters (or just about anything you want) in real time while your iLogic rules are running.  This can be used to find those pesky bugs that may be running amuck in your code

You use DebugView in conjunction with Trace calls in your code. For example, below is a line from an iLogic rule:

Trace.Writeline("iLogic: This will output to DeBugView")

DeBugView will show this:




It's an alternative to throwing a bunch of MessageBoxes into your code.

You'll notice the iLogic: at the beginning of my string.  I use this in conjunction with the Filter tool in DebugView so that I'm not inundated with other messages.

The Filter dialog box will launch when you start DebugView.  Add something like iLogic to the Include: box to filter out everything else other than lines that include iLogic.

Another feature worth looking into is the Highlight feature.  It can highlight either the foreground (text) or the background of each output line with a color (depending on your choice in the Colors box).  I've set the filter in the image to the right to highlight the background of each line green if it has the text Debug in it and here's the output in DebugView:


I used the Highlight feature when I want to easily find specific output in the DebugView window.

As I stated earlier, you can output Parameters or variables to DebugView.  One way that I used this often is to see what a parameter is at a specific point in a rule.  In the example below, the variable   is looping from 1 to 10.  I'm combining  along with portion of the parameter End1MachLevelStep(n) to see what the parameter values are.

For stepno = 1 To 10
    Trace.Writeline("iLogic: End1MachLevelStep" & stepno & ": " & Parameter("End1MachLevelStep" & stepno))
Next



You can download DebugView from here.

Leave a comment below to let me know how you use DebugView.

"There are two ways to write error-free programs; only the third one works" ~ Alan J. Perlis

Thanks and happy debugging!
Randy

No comments:

Post a Comment