user9643570
user9643570

Reputation: 37

V3125 False Positive

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

Answers (1)

Paul Eremeeff
Paul Eremeeff

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

Related Questions