dotnet/roslyn

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

开放

#50,867 创建于 2021年1月28日

 (0 条评论) (0 个反应) (0 位负责人)C# (4,257 个派生)batch import
Area-InteractiveBugInteractive-Debugginghelp wanted

仓库指标

星标
 (20,414 个星标)
PR 合并指标
 (平均合并 6天 17小时) (30 天内合并 256 个 PR)

描述

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.

贡献者指南