Skip to content
| Marketplace
Sign in
Visual Studio>Tools>ExpressionViewer
ExpressionViewer

ExpressionViewer

CristiIngineru

|
677 installs
| (0) | Free Trial
Roslyn based Visual Studio extension for evaluating C# expressions at edit time. Under development.
Download

Summary

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
  • ... suggestions are welcome!

 

 

Changelog

0.4

  • Fix the expression locator for CRLF line ending files
  • Fix the sporadic crash happening when closing VS

0.3

  • Evaluate the expression around the text cursor

0.2

  • Use the active document to generate the preview
  • Stop the view generator when the extension window is hidden and start it back when visible
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft