Roslyn based Visual Studio extension for evaluating C# expressions at edit time.Under development.
After installation the ExpressionViewer tool window can be found in View -> Other Windows -> ExpressionViewer.
Current status
The tool is extracting the expression around the text cursor in the active document and adds instrumentation around it. Then it executes that instrumented piece of code in the background and prints the result.
Restrictions:
The final data type of the expression has to be string
The file has to be saved
The hole assembly compilable (compilation is being performed automatically in the background in a temp folder)
Using instance members to define an expression can prevent the evaluation at edit time since they are available/resolved at run time only.
Warning
If the expression under evaluation contains calls to static methods then those methods will be called while generating the preview. Depending on the behaviour described in those methods this could cause side effects!
Future development
Expressions of numeric data types
Instance members replaced with placeholders
The object from the beginning of a call chain replaced with a default value
Sandboxing for preventing the side effects of the evaluations