ingovals
ingovals
CC#
Created by ingovals on 3/14/2023 in #help
❔ What could cause the compiler to not infer this nullability correctly
if (pageNumber.HasValue)
{
query["PageNumber"] = pageNumber.ToString();
}
if (pageNumber.HasValue)
{
query["PageNumber"] = pageNumber.ToString();
}
I get the warning here about possible null reference, but it is pretty obvious that this could be inferred by flow analysis. I'm assuming something is wrong, old codebase, old compile etc. I just don's use .net as much anymore and I haven't kept up. What should I look at?
9 replies