This is the current user interface of NStatic. By the time, the user interface will undergo additional changes before I release it.

The tool is capable of analyzing code in isolation and handling ambiguities due to incomplete information (such as whether a symbol is a type or a variable). In this example, there are two files being analyzed: Sample.cs and Sample2.cs.

The snapshot for Sample.cs is shown above and Sample2.cs is available as a File Attachment. Together, these two files produce the 10 errors and 1 warning in the Error List pane shown here.

In this window, the error produced from the code displayed earlier is currently selected. The error messages are meant to be identical to the ones that would ordinarily occur at runtime, but, in some cases, for the standard exceptions automatically generated by the runtime, I have added additional explanatory text (such as whether an out-of-bounds index was negative or too high). For custom exceptions, NStatic will dynamically evaluate and construct the exception and then extract the message contained inside.
Besides the Error List pane, there are three additional panes: the Call Stack Pane, the Locals Pane, and the Assumptions Pane.

The Call Stack Pane reveals the call stack at the time the error occurred. The Locals Pane above contains a hierarchical tree grid that reveals the values of each of the locals (and instance members) at the time the error occurred, expressed symbolically in terms of the original function parameters (include the this parameter). These expressions may contain constant values (including user-defined object instances) and function bindings. The value p’ reflects the original value of parameter p, since the variable p may change at any time.

The Assumptions Pane reveals the working assumptions the compiler relied on upon reaching the error. In this case, there is only one set of assumptions.
The example above was not what I originally intended.. I simply forgot to modify my example.
I meant to make assign p + 2 to i, and then assign 1 to p.
The local windows would then have shown:
i = 2 + p'
p = 1
data = null
and the if statements would have used i instead of p, resulting in the assumptions:
p' = 3 p' = -1
Posted by: Wesner Moise | February 26, 2006 at 04:36 AM
The last comment should read: p' less= 3 and p' greater-equal -1.
Ampersands and inequality symbols used in HTML were automatically stripped out by the comment service.
Posted by: Wesner Moise | February 26, 2006 at 04:40 AM
It looks great. There was a time I wanted to write something like this, but gave up for lack of time.
I have to say this is an incredible tool and it has great potential.
What other static checks can NStatic perform?
Can one write custom checks for it?
How much do you approximate it would cost?
Posted by: Omer van Kloeten | February 26, 2006 at 08:42 AM
I have a later post that answers a few of your questions...
I'll add an exhaustive set of checks over time, but I don't really see any real limit to what this tool could eventually do. Implementing new checks is fairly trivial, but some checks may add considerably to scanning time.
I have a rules languages that supports a declarative way of specifying custom checks and specifications, but have moved it away.
Posted by: Wesner Moise | February 26, 2006 at 05:38 PM
The placement of the progress bar just looks weird to me. I'd recommend either putting it in the status bar (bottom of the page) or popup a standalone window with the progress bar & a cancel button.
Posted by: Jim Geurts | February 26, 2006 at 10:12 PM