icsharpcode/ILSpy

Feature Request: Interative Run a method within a package (roslyn REPL)

Open

#1293 opened on Oct 6, 2018

View on GitHub
 (0 comments) (0 reactions) (0 assignees)C# (25,162 stars) (3,645 forks)batch import
Help WantedNew FeatureUI

Description

Roslyn made possible do run code interactively on dot net platform as REPL. Visual Studio later introduced a C# Interative Window to quickly run any piece of code without the painful work of setup a project just to evaluate a piece of code.

The idea of typing a code and evaluating the output is a common approach used by scripting languages that now is possible with c#.

https://github.com/dotnet/roslyn/wiki/C%23-Interactive-Walkthrough https://github.com/dotnet/roslyn/wiki/Interactive-Window

ILSpy could make a even better use of it if we could run any piece of code, without requiring to reference it in a project to wire up all dependencies.

There are a few tools using this feature already, follow a few to have an idea:

Having this feature on ILSpy would be handy, we could right click in a method, and 'Run it', ILSPy would arrange an interactive window with the basics to run a method already setup like the following:

#r "path/MyAssembly.dll"
using System;

var dependencyA = new Depdencency();
var obj = new ClassToTest();
obj.MethodClicked("required dummy data", dependencyA);

Or just the fact of having an interative window with the path (first line) set would be useful.

Contributor guide