How to tell the C# nullable analyzer a member is not null when HasValue is true
Put [MemberNotNullWhen(true, nameof(X), nameof(Y))] on the HasValue property itself, naming the members that become non-null. It works for nullable value types and reference types, but the compiler barely checks the getter, ignores base-class members, and never notices when the state changes afterwards. Verified on .NET 10 SDK 10.0.302 and .NET 11 RC3.