There is a known bug in the Microsoft CLR on the x86_64 platform with regards to initializing an array whose members are enum values (http://connect.microsoft.com/VisualStudio/feedback/details/635365/runtimehelpers-initializearray-fails-on-64b-framework). It appears that the Microsoft csc compiler somehow works around this whereas gmcs does not. For example, the following compiled with gmcs does not run on the Microsoft CLR on x86_64 (it throws an exception in InitializeArray) but does when compiled with csc:

class Program
{
  enum e { A, B, C, D, E };
  static void Main()
  {
    e[] array = new e[] { e.A, e.B, e.C, e.D, e.E };
  }
}

I appreciate this is apparently a bug with the Microsoft 64 bit CLR rather than mono, but at the moment Microsoft's csc appears to work around this where mono does not. Is there a way of telling gmcs to not use a call to InitializeArray when instantiating arrays of enums (instead doing something like: e[] array = new e[5]; e[0] = e.A; e[1] = e.B; ... for the above example), or if not would there be any support for adding this (e.g. via an optional command line flag to gmcs)?

Regards,
John.
_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list

Reply via email to