dotnet/roslyn

VS Immediate Window (expression compiler) ignores stamenents after semicolon

Ouverte

#56 976 ouverte le 6 oct. 2021

 (0 commentaire) (0 réaction) (0 personne assignée)C# (4 257 forks)batch import
Area-InteractiveBughelp wanted

Métriques du dépôt

Stars
 (20 414 étoiles)
Métriques de merge PR
 (Merge moyen 6j 17h) (256 PRs mergées en 30 j)

Description

Version Used: Visual Studio 2019 v16.11.4.

Steps to Reproduce:

  1. Start debugging of any project.
  2. Enter any multi-statement line into the Immediate Window. For example, int i = 3; i = 1337;
  3. Press Enter.
  4. Enter the expression i and press Enter again, to examine the current value of the variable.

Expected Behavior: Immediate Window should execute every statement and tell me that i = 1337.

Actual Behavior:

int i = 3; i = 1337;
Expression has been evaluated and has no value
i
3

image

Notably, if I enter a slightly different statements:

i = 3; i = 1337;

then the expression compiler generates an error message:

error CS1073: Unexpected token ';'

Guide contributeur