[Mono-dev] C# pointer dereference NRE bug

StApostol stapostol at gmail.com
Tue Oct 2 06:28:33 EDT 2007


The following code runs correctly under .Net but produces an NRE under Mono
1.2.5 (both mcs and gmcs):

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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20071002/1e850b98/attachment.html 


More information about the Mono-devel-list mailing list