[Mono-bugs] [Bug 667692] New: AvoidAlwaysNullFieldRule false positive

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Jan 27 12:07:57 EST 2011


https://bugzilla.novell.com/show_bug.cgi?id=667692

https://bugzilla.novell.com/show_bug.cgi?id=667692#c0


           Summary: AvoidAlwaysNullFieldRule false positive
    Classification: Mono
           Product: Mono: Tools
           Version: 2.10.x
          Platform: Other
        OS/Version: Windows XP
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Gendarme
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: avandecreme at sopragroup.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.9.2.13)
Gecko/20101203 Firefox/3.6.13 ( .NET CLR 3.5.30729; .NET4.0E)

This snippet fire false positive :

    class Program
    {
        private string[] bar = null;

        public void SetBar(IEnumerable<string> boo)
        {
            bar = boo == null ? null : boo.ToArray();
        }
    }

Reproducible: Always

Steps to Reproduce:
1. Compile the snippet
2. Run gendarme
3.
Actual Results:  
AvoidAlwaysNullFieldRule fire a defect

Expected Results:  
No defect :)

Note that the following code don't fire the defect:

        public void SetBar(IEnumerable<string> boo)
        {
            bar = boo != null ? boo.ToArray() : null;
        }

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list