dotnet/roslyn

Use of possibly unassigned field '_dummyPrimitive' (with sharplab)

Open

#67,212 opened on 2023年3月7日

GitHub で見る
 (8 comments) (1 reaction) (0 assignees)C# (4,257 forks)batch import
Area-CompilersConcept-Diagnostic ClarityResolution-By Designhelp wanted

Repository metrics

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

説明

Version Used: All versions available on sharplab

Steps to Reproduce:

  1. write (non-async) Task method
  2. write if expression on some bool + resolving a nullable value, e.g. "msg.isFoo && msg.NullableId is not Guid id".
  3. write local (async) implementation method inside the first method that uses the non-nullable result (binds this+id) and call it. ...Error manifests if the result of the nullable expression is used inside the local method, e.g. "Console.Write(id);"

A minimal repro, with source-code provided, is ideal. Using sharplab is preferred for compiler/language issues whenever possible: https://sharplab.io/#v2:C4LgTgrgdgNAJiA1AHwAICYAMBYAUBgRj1UwAJUCBWAbj2IGZz1yCB2PAbz1J/MYoBs5IQFkAhgEsoACgCU3Xl1y8VpAG5iwpALYBTAM76xAc12kAvKSi6A7qREGjpgCLAA9nNrLVPBT4kAZqTSeoYmugB0EvoAYm5upABkiTqO4VFw4gCeAEZm0VZuwKQA4hAScKQV8t4+Sj4+FACc0gBEgDwbgCD7rbJeDaqorMIRAMJu2gAOADa6wLpwqAJ9DQC+fqrrKoOkAIL6WVAAxgCSk1Oem7yXPKgAHMK7+0en03LXpPX9vIHBoU6R0TibhqX0U736zWk1WWoLWtVUcJUcLhxGYDjCLncnHWqEYOXiUyqsXiH1MwGoiN4uNK5TgAH4qpkxLkzBwyRS8CsgA

Diagnostic Id: CS0170

Expected Behavior: No error.

Actual Behavior: Error on hidden compiler variable.

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