[Mono-dev] C# pointer dereference NRE bug

Jb Evain jb at nurv.fr
Tue Oct 2 06:39:23 EDT 2007


On 10/2/07, StApostol <stapostol at gmail.com> wrote:
> The following code runs correctly under .Net but produces an NRE under Mono
> 1.2.5 (both mcs and gmcs):

It's a mcs/gmcs bug. The csc compiled version executes fine on Mono
1.2.5, while the mcs compiled version fails with the same exception on
.net.

Could you please file a bug in bugzilla?

Thanks,

> using System;
>
> namespace Bug {
>     unsafe class Demo {
>          static void Foo(int[] data) {
>              fixed (int* data_ptr = data) { /* Do something */ }
>          }
>          public static void Main() {
>              Foo(null);    // Passing null causes the NRE
>         }
>     }
> }
>
>
>
>
> Unhandled Exception: System.NullReferenceException: Object reference not set
> to an instance of an object
>   at Bug.Demo.Main () [0x00000] in
> /home/vm/Desktop/mono_bugs/unsafe.cs:9
>
>
>
> Can anyone confirm?
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>


-- 
Jb Evain  <jb at nurv.fr>



More information about the Mono-devel-list mailing list