[Mono-dev] Array and IEnumerable

Yopmaster trouve.antoine at mac.com
Tue Jun 30 22:30:32 EDT 2009


I think your issue is due to another huge difference between Mono and .NET
which leads to this kind of error. Here is an example:

Let us consider "Human" and "Child" so that "Child" is derived from "Human":

  class Child : Human {}

If now you create the List of type

  List<Child> children;

In .NET, "children" will also implement the type "List<Human>":

  children is List<Child>
  >>> true
  children is List<Human>
  >>> true

But in Mono it will not be the case:

  children is List<Child>
  >>> true
  children is List<Human>
  >>> false

The only way to fix it would be to use some "#if MONO" / "#else" /

In your case
  "Human" would be "System.Array"
  "Child" would be "System.String[]"
  "List" would be "System.Array.InternalEnumerator"

Does it answer to you question ?

If somebody from the mono programming could read this post and fix the
issue... (and by the way thank you for the great pieace of software that
Mono is)

I'm running Mono 2.4 on Windows and am getting a similar error - is there
any solution to this bug ?
System.Array.InternalEnumerator<System.String[]> doesn't imple
ment interface System.Collections.Generic.IEnumerator<System.Array>
ERROR:mini-trampolines.c:67:mono_convert_imt_slot_to_vtable_slot: code
should no
t be reached

This application has requested the Runtime to terminate it in an unusual
Please contact the application's support team for more information.



View this message in context: http://www.nabble.com/Array-and-IEnumerable-tp18146456p24283208.html
Sent from the Mono - Dev mailing list archive at Nabble.com.

More information about the Mono-devel-list mailing list