C# Interactive console / prompt buggy

Answered

The C# interactive console is a very useful tool to quickly test things out while not having to write a complete program. It gives me a lot of error messages and differs quite a bit in execution from the Visual Studio C# Interactive Window version.

First of all it gives an error message as soons as you refer to the current project. If you do that the line '#r “<path to current executable>” appears:

 (1,88): error CS1025: Single-line comment or end-of-line expected

Next, as soons as you make an error, that error seems to be persistent. Every follow up command shows that error. It seems to me like it rerun all previous commands when you enter a new command.

Lastly, If you type the name of a variable, it shows the content. If you type another command, it remembers that name/letter and adds it to the next line.  That is also not the same behaviour as in Visual Studio C# Interactive Window.

0
2 comments

Another problem is if you change the project, rebuild it and then reference the project, it also gives an error. You need to reset the C# Interactive console first otherwise you get an error:

> > #r ""
#r ""
#r "<path to executable>"
> > > (1,24): error CS1040: Preprocessor directives must appear as the first non-whitespace character on a line

0

If you just add references by #r “<path to executable>”  , it should work. 

The problem is raw string literals (triple quotes) auto-completion is conflicted with line breaks in C# interactives. 

We have a related bug ticket here: RIDER-116384 C# interactive input issues

Please vote it so that you will receive notification when it's updated.

0

Please sign in to leave a comment.