[Mono-bugs] [Bug 613397] New: Object Initializers do not initialize boolean values

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Jun 10 17:35:08 EDT 2010


http://bugzilla.novell.com/show_bug.cgi?id=613397

http://bugzilla.novell.com/show_bug.cgi?id=613397#c0


           Summary: Object Initializers do not initialize boolean values
    Classification: Mono
           Product: Mono: Compilers
           Version: 2.6.x
          Platform: x86-64
        OS/Version: Ubuntu
            Status: NEW
          Severity: Critical
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: greg.smolyn at strangeloopnetworks.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-US)
AppleWebKit/534.1 (KHTML, like Gecko) Chrome/6.0.427.0 Safari/534.1

Object initializers do not assign values to booleans, they remain in their
default constructed state.



Reproducible: Always

Steps to Reproduce:
Compile following code:


using System;

namespace InlineAssignmentTest
{

    public class Foo
    {
        public bool B = true;
    }



    public class MainClass
    {
        public static void Main(string[] args)
        {
            var foo = new Foo() { B = false };
            // foo.B should be false but it's true

            Console.WriteLine("Done: B == " + foo.B);
        }
    }
}

Actual Results:  
B is true

Expected Results:  
B is false

This runs correctly when compiled and run in VS2010.
I have not tested compiling in VS2010 and running in mono, or vice-versa.
This may also only be related to boolean instance vars and not properties.

-- 
Configure bugmail: http://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