-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Open
Description
Discussed in #80765
Originally posted by UniqeId6542 October 16, 2025
class Data { public bool Value { get; set; } }
void Foo(Data? data)
{
data!.Value = true; // OK
bool b1 = data!.Value = true; // OK
_ = data!.Value = true; // OK
data?.Value = true; // IDE0058
bool? b2 = data?.Value = true; // OK
_ = data?.Value = true; // OK
}
For null conditional assignments, I'd like it to NOT produce IDE0058 - the same as normal assignments.
I have IDE0058 set to make a warning so as to avoid missed data from method returns. But I don't want to have to "handle" the data from a null conditional assignment. And, I notice that normal assignments don't produce this message even though they also have a form of data return from the expression.
Metadata
Metadata
Assignees
Labels
No labels