Visual Studio version: Microsoft Visual Studio Community 2022 (64-bit) - Current Version 17.13.6
SonarQube for Visual Studio plugin version: SonarQube for Visual Studio 2022, v8.17.0.12886
Programming language you’re coding in: C#
Is connected mode used: no
And a thorough description of the problem / question:
A NRE is not detected in the following code:
public class Test
{
public string Prop { get; set; }
}
public static string GetProp(Test t1, Test t2)
{
if (t1 != null)
return t1.Prop;
if (t2 != null)
return t1.Prop;
return string.Empty;
}
static void Main()
{
var prop = GetProp(null, new Test { Prop = "hey" });
Console.WriteLine(prop);
}
Obviously, this is a simplified version of what we encountered, but on a colleague’s PC, with VS 2019, it was detected initially, but then after building again, not any more. Super strange.
Hi Ann,
just checked, I have no updates, but meantime SonarQube probably auto-updated to 8.18.0.13071… I can’t find a 10.xx version, even after uninstalled 8.18, so I reinstalled it.
I can confirm, the issue still reproduces with latest SonarQube I could find.
Cheers,
Marton