the blog
Back to -Blog

Flex Debugging In Visual Studio 2010

Amethyst Developments
by Dermot Hogan
Friday 21 May 2010.

I’ve just been updating Amethyst for Visual Studio 2010 – and while doing so, I came across an ActionScript oddity.

A few weeks ago, we released the first version of Amethyst for Visual Studio 2010 (a.k.a. Amethyst 2010). Since then, I’ve been fixing bugs and generally improving the side-by-side operation with Visual Studio 2008, so I thought it was time for another release. Our intention is to release an edge edition of both Amethyst 2008 and Amethyst 2010 at more or less the same time in the near future. The major new feature is that we now have, for the first time, a Designer built in Flex 4 – and very nice it looks too!

One of the bugs reported was that Amethyst didn’t display static variables of classes correctly. In fact, it didn’t display them at all. So if I had some code like this:

public class B {
   public static var:_b:Array = new (1,2,3);
   public B() {}

Then typing ‘B’ in the Immediate Window or Watch window failed to produce anything useful. This turned out to be a problem in the Expression Evaluator which didn’t recognise anything that wasn’t an instance of a class.

This was easily fixed and now I do indeed get something useful in the Watch Window

But on doing a bit more testing, I found something odd – and I assumed that it was a bug of mine ... but not quite!

To test the static expression evaluation, I implemented a class like this

public class A extends B {
   public static var _a:Array= new Array("a", "b", "c");
   public function A() { }

and then tried this:


Nope. The Adobe Virtual Machine refused to play. This was the output in the Immediate Window:

You can see the the static variable _a of the class A is displayed correctly as it the static variable _b of class B. But trying to display the ’inherited’ static variable _b in the class A failed.

After going cross-eyed staring at the code looking for bugs for some considerable time and more than a good bit of head scratching, I tried to compile the expression. Now the compiler refused to play! And it turns out that unlike C#, say, public static variables are not inherited, whereas public non-static variable are! I’ve no idea why Adobe should have done something as weird as this – but there it is.

But apart from that, Visual Studio 2010 is behaving just fine – breakpoint counts work - conditionals work very well, and I find them to be very useful:

And the Cylon debugger is really pretty slick and responsive since it connects directly to the AVM and bypasses any FDB code. The decision to build a clean debugger implementation involved a lot of hard work, but it means that tracking down problems like the static resolution above and Visual Studio 2010 integration is easy. Apart from when Adobe’s idiosyncratic version of inheritance gets in the way of course!

Bookmark and Share   Keywords:  Amethyst  debugger
© SapphireSteel Software 2014