PropertyAccessor can't work well when property type is int?

Feb 18, 2009 at 3:42 AM
//it response random number, not 15

public partial class Default2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Foo foo = new Foo(15);
        PropertyAccessor<Foo, int> accessor = new PropertyAccessor<Foo, int>("Count");
        Response.Write("count: " + accessor.Get(foo));
    }
}

public class Foo
{
    public Foo(int count)
    {
        Count = count;
    }
    public int Count
    {
        get;
        set;
    }
}
May 3, 2009 at 4:06 PM
Same problem for me,
it returns a random number
Anyone got the clue ?

May 5, 2009 at 12:05 PM
BasePropertyAccessor.cs
line 218~224
from 
        private static void EmitBoxIfNeeded(ILGenerator il, System.Type type)
        {
            if (type.IsValueType)
            {
                il.Emit(OpCodes.Box, type);
            }
        }
to
        private static void EmitBoxIfNeeded(ILGenerator il, System.Type type)
        {
            //if (type.IsValueType)
            //{
            //    il.Emit(OpCodes.Box, type);
            //}
        }

it's work for me.



2009/5/3 alainb33 <notifications@codeplex.com>

From: alainb33

Same problem for me,
it returns a random number
Anyone got the clue ?

Read the full discussion online.

To add a post to this discussion, reply to this email (FastInvoker@discussions.codeplex.com)

To start a new discussion for this project, email FastInvoker@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


May 11, 2009 at 2:47 PM

Thanks to Haytham for his 1.1 release which solves this problem !