dotnet/roslyn

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

オープン

#50,867 opened on 2021/01/28

 (0 件のコメント) (0 件のリアクション) (0 人の担当者)C# (4,257 件のフォーク)batch import
Area-InteractiveBugInteractive-Debugginghelp wanted

Repository metrics

Stars
 (20,414 個のスター)
PR merge metrics
 (平均マージ 6d 17h) (30d で 256 merged PRs)

説明

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.

コントリビューターガイド