the blog
Back to -Blog

Visual Studio Flex Debugging

’Cylon’ preview
by Dermot Hogan
Wednesday 11 November 2009.

One of the things we’ve tried very hard to do with Amethyst is to follow the Visual Studio way of doing things. Not because we’ve been required to do so by Microsoft (though there are some detailed style guides that Microsoft strongly suggest you follow), but more because it’s the best way of doing things. One small example of this is how the variables are organized in the debugger’s Watch and Local windows. The variables are typically put into a tree so that you can ‘drill- down’ into the variable and see what’s there.

But if you look at variables in the C# Watch and Locals windows, you’ll see that there’s a bit more going on. First, the base class isn’t given the name of the base class. Instead, it’s given the name base. Second, static members of the class are grouped under the Static members. Third, private and protected variables are grouped under Non-public members category. In my first version of the debugger, the one based on FDB and which is included in the current beta (beta 6), I haven’t bothered with this type of categorization – and the result really is pretty confusing when expanding an item with a lot of members such as ‘this’.

But in the Cylon version (see my last blog post for an overview of this), I followed the Microsoft convention and I have to say (to my surprise) that it’s a lot clearer. Doing it wasn’t difficult either. Typically, in C#, you sort items using a SortedList class. This, by default, uses a simple alpha-numeric sort - like this:

_children = new SortedList();

But if you want some fancy sorting, all you need do is this instead:

_children = new SortedList(new MyCompare());

The MyCompare class implements the ICompare interface which has just a single method Compare which ranks two objects given to it as arguments. This class then ensures that all static members, say, have the lowest sort order while the ‘base’ item has the highest. There’s a bit more to it than this, but in essence it all works out rather neatly.

And, as I’ve said – the result really is much clearer. The first release of the Amethyst Cylon debugger should be ready in our beta.

Bookmark and Share   Keywords:  Amethyst  debugger
© SapphireSteel Software 2014