dotnet/roslyn

Internal error in the C# compiler when using "is" operator in VS 2019 watch window

Aberta

#50.867 aberto em 28 de jan. de 2021

 (0 comentário) (0 reação) (0 responsável)C# (4.257 forks)batch import
Area-InteractiveBugInteractive-Debugginghelp wanted

Métricas do repositório

Stars
 (20.414 estrelas)
Métricas de merge de PR
 (Mesclagem média 6d 17h) (256 fundiu PRs em 30d)

Description

Version Used: .net 5.0 , VS 16.8.4

Steps to Reproduce: object ob = "Baseball"; var istype = ob is int dc ? "game" : "nothing";

  1. Hit the breakpoint at var istype
  2. Add "ob is int dc" to watch widow. It throws the following exception: ob is int dc | error CS0136: A local or parameter named 'dc' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter |   (I don't know why)
  3. In the same watch window, replace dc with any other token, say, marvel (ob is int marvel). This shows "Internal error in c# compiler" (you might have to hit enter twice)

Expected Behavior: show false. Actual Behavior: Shows above to errors.

Guia do colaborador