Good day,

Thank you Mono-Team for your excellent work.

I've been working with multidimensional arrays and have run into some
code that compiles fine with both mcs and Microsoft's C# compiler, runs
fine in Microsoft's runtime and with mint, but throws a
NullReferenceException with mono. 

(I'm not sure the problem is tied to multidimensional arrays - it's just
that it is the only place that I've managed to replicate it.)

The code below demonstrates the problem. The commented-out (functionally
equivalent) version in the sample runs fine.

More info that I hope will help: Mono 1.0.5 on WinXP SP2 x86. The
assembly verifies fine with Microsoft's PEVerify. 

Sorry that I can't get to a Linux box right now to test this against svn
head.

<sample>
using System;

class Host 
{
    public static void Main() 
    {
        int[,] a = new int[4,4];
        for(int i = 0; i < 4; ++i)
        {
            for(int j = 0; j < 4; ++j)
            {
                a[i, j] = i + j;
            }
        }

        int[,] b = new int[4,4];
        for(int i = 0; i < 4; ++i)
        {
            for(int j = 0; j < 4; ++j)
            {
                // NullReferenceException thrown here:
                b[i,j] = a[0,(i + j) % 4];

                // This (equivalent) code works fine:
//                int c = (i + j) % 4;
//                b[i,j] = a[0,c];
            }
        }
    }
}
</sample>

Best Regards,

Mike

_______________________________________________
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to