[Mono-devel-list] [Bug] Mono exception handling in multidimensional arrays

dietmar dietmar at ximian.com
Wed Jun 4 08:29:18 EDT 2003


Or do you run mono on MS Windows?

On Wed, 2003-06-04 at 13:18, Saajan Singh Chana wrote:
> Hi,
> 
> I recently noticed that mono seems to incorrectly handle 
> IndexOutOfRangeExceptions in multidimensional arrays.  The following 
> code demonstrates the error:
> 
> using System;
> 
> class ArrayExceptionTest
> {
>   public static void Main(string[] args)
>   {
>    try
>    {
>     bool[] array = new bool[2];
>     array[-1] = true;
>    }
>    catch(IndexOutOfRangeException)
>    {
>     Console.Out.WriteLine("Caught IndexOutOfRangeException on 
> one-dimensional array; works on mono and .NET");
>    }
>    try
>    {
>     bool[,] array = new bool[3,3];
>     array[-1,0] = true;
>    }
>    catch(Exception)
>    {
>     Console.Out.WriteLine("Caught IndexOutOfRangeException on 
> two-dimensional array; only works on .NET");
>    }
>   }
> }
> 
> It compiles fine, and the first try..catch works fine on both mono and 
> .NET.  However, the second try..catch works on .NET but on mono the 
> program crashes with the message
> 
> Unhandled Exception: System.IndexOutOfRangeException: Array index is out 
> of range.
> 
> Apart from that, you guys are doing a great job.  Keep it up!
> 
> Saajan
> 
> 
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list




More information about the Mono-devel-list mailing list