dotnet/roslyn
Auf GitHub ansehenNullability warning is missing on the lock statement
Open
#76.597 geöffnet am 2. Jan. 2025
Area-CompilersFeature - Nullable Reference Typeshelp wanted
Repository-Metriken
- Stars
- (20.414 Stars)
- PR-Merge-Metriken
- (Durchschn. Merge 6T 17h) (256 gemergte PRs in 30 T)
Beschreibung
Version Used: 17.13.0 Preview 2.1
There is no nullability warning for lock (null) { } or lock (maybeNullExpr) { }, even though a null at runtime throws ArgumentNullException.
Expected
A nullability warning such as:
-
CS8604 - Possible null reference argument for parameter.
- More literal, similar to how
awaitorforeachsimply reflect the warning you'd get if you had manually called GetAwaiter()/GetEnumerator().
- More literal, similar to how
-
CS8602 - Dereference of a possibly null reference.
- A step back, if calling
exprinlock (expr)a "parameter" is leaking too much information about howlockis being lowered.
- A step back, if calling
Or, one in the same vein as "CS8597 Thrown value may be null."