Sunday, August 27, 2006

VS2005 QuickWatch "bug" + DILE v0.2.3

I'll start with the shorter news. I found an interesting "bug" in Visual Studio 2005:

  1. Create a new project in VS2005.
  2. Don't write any code in it, just start debugging.
  3. Write the following expression in the Quick Watch window and get it evaluated:
    new Guid[] {Guid.Empty}
    The displayed value will be an error message:
    "Cannot dereference expression. The pointer is not valid."
    *sigh* I know this error message too well (the "advantages" of developing a debugger :-)).

If you include some code in your project that uses Guids (e.g.: Guid guid = Guid.Empty;) then the expression will be evaluated correctly.

It's really not a huge bug, rather just fun to know about it. :-)
I submitted this problem to Ladybug also.

 

And now the good news: DILE v0.2.3!
The usual files can be found here:

zip file: dile_v0_2_3.zip
readme.txt: readme.txt
license.txt: license.txt
change_log.txt: change_log.txt

The new features are the following:

  • expression evaluation during debugging (generics are not supported yet)
  • startup assembly/program can be specified along with the arguments and working directory
  • debugging can be started with stepping (in such cases DILE will pause the debuggee when the first IL code is hit)
  • run to cursor
  • stop debuggee only when an unhandled exception is thrown
  • filtering debug events that are shown in the Debug Output Panel
  • automatic detection of the .NET Framework version when attaching to a process
  • refreshing displayed processes in the Attach to process window
  • adding not loaded assemblies to the DILE project made easier (right click in the call stack on an "Unknown method..." line and choose "Add the referenced module to the project" option from the popup menu)
  • Object viewer menu to quickly display the Object Viewer window during debugging (shortcut by default: Ctrl + W)

No doubt, I consider the first to be the most important (and that took the most time to implement).
I think a very useful thing during debugging is that it is possible to call methods, check properties and inspect variables and not just local variables or arguments. From now on it is possible to do these kind of things in DILE also. Here are a few example expressions that I used for testing:

5 * -6
1 + 2 * 3 - 10 / 5 * 5
(1 + 2 * 3 - 10 / 5 * 5).ToString()
(-5).ToString()
new object() + "a"
"abc".Length.ToString()
System.Type.GetType("System.String").GUID.ToByteArray()
TestApplication.DebugTest.CreateOperatorTest4("op1") | true
TestApplication.DebugTest.ParamsTest2()
TestApplication.DebugTest.ParamsTest2(5, 6)
System.String.Format("{0}{1}{2}{3}{4}", "a", "b", "c", "d", "e")
new object[] {4, "a", 5}
((System.Exception){exception}).Message

At least these should be evaluated correctly. :-)
Usage of overloaded operators is also implemented, just like automatic conversions (implicit/explicit cast operators are also used if it's necessary).
Currently DILE uses the debugging API that is included in the .NET v1.0/v1.1. This means that the functionality is similar to VS 2003. However, there are some expressions that VS 2003 can't evaluate but DILE can (like creating new arrays).

And as always, here are a few screenshots of the new features:

 


Evaluating a System.String.Format() method call

Evaluating an argument's field (while debugging Windows Live Writer :-))

Specifying startup arguments

New Attach to process window (not necessary to manually choose the .NET Framework version)

Adding a not loaded assembly from the Call Stack Panel

So, that's it. I hope DILE has become more useful and worthed the waiting.

My plans about the next version is, of course, to fix the bugs first of all. And I'll spend some time to make the UI more usable. I'm not very satisfied with the grids... I think there are already lots of useful features in DILE but the UI "is a little bit behind the functionalities". And 1 more thing that I plan to include in the next version is setting the IP and this will mean some UI change as well.

As always, please let me know if you find any bug (I'm sure, both the parser and the evaluator algorithm is not perfect yet), or have any suggestion.

P.S.: I post this entry from Windows Live Writer. I hope the post will really look like in the editor. :-)