Reputation: 37
PVS Studio throws V3125: The 'control.Parent' object was used after it was verified against null. Check lines: 11, 9.
using System.Windows.Forms;
namespace V3125_False_Positive
{
static class Program
{
static void Main()
{
if (new Control() is Control control && control.Parent != null)
{
string parentname = control.Parent.Name;
}
}
}
}
Is this a false positive?
Upvotes: 0
Views: 49
Reputation: 291
Indeed, this is a false positive. We'll look into it and try fixing it for the next release (actually, for the release after the next one, as we are planning to release a new version in about a week, so the fix will not make it).
Thanks for the tip!
Upvotes: 1