[Mono-dev] Array and IEnumerable

Yopmaster trouve.antoine at mac.com
Fri Jun 27 04:01:03 EDT 2008


I'm answering to myself since I think one could find it ineresting.

The cause of the problem was that the interface was not implemented. You'd
say I'm stupid BUT that was tricky. Here is the context:

I had two interfaces:

  public interface Interface1 {}
  public interface Interface2 {}

And the following class:

  public class MyClass : Interface1, Interface2 {}

In which only only Interface1 was implemented: I forgot the second one.
And it used to compile.

So a few minute ago I decided to remove Interface1 :

  public class MyClass : Interface2 {}

and the the compiler told me that I forgot to implement some (in fact all)
functions of Interface2.

The amazing part is that both MS and Mono compiler did not detect the
problem, and until I did not call those functions, no exeption was raised.
And casting to Interface2 with .NET was not problem while it raised an
exception (in fact it sorta crashed) under Mono.

Any experience related to that ?

Antoine


Yopmaster wrote:
> 
> Hello everyone, I'm brand new on this forum.
> 
> I'm porting a C# application to mono 1.9 (I'm testing on MacOSX10.5) and I
> got some issues. This one occurs during an XML serialization.
> I've managed to solve some XML serialization issues by myself before, but
> I'm not getting this error, which I suspsect is a bug of the VM:
> 
> -------- Begining of the error --------
> 
> Fleets.Redefis.Hardware.RDP.XML.RDPL.LUTRDPModule[] doesn't implement
> interface
> System.Collections.Generic.IEnumerable<Fleets.Redefis.Hardware.RDP.XML.IXMLModule>
> 
> ** ERROR **: file mini-trampolines.c: line 42
> (mono_convert_imt_slot_to_vtable_slot): should not be reached
> aborting...
> Stacktrace:
> [...]
> ../../working_dir/launchSimu.sh: line 19: 66088 Abort trap
> 
> -------- Enf of the error --------
> 
> To sum-up, I've a class LUTRDPModule thath implement interface IXMLModule
> 
>   class LUTRFPModule : IXMLModule {
>     [...]
>   }
> 
> And an array of LUTRDPModule
> 
>   LUTModule modules
> 
> Which I cast into a Collection
> 
>   (ICollection<IXMLModule>)modules
> 
> It looks like array in Mono are not enumerable, tough they are in .NET.
> And the ** ERROR ** looks like a bug in the VM.
> 
> Am I wrong ?
> 
> Thank you very much
> 
> Antoine.
> 

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



More information about the Mono-devel-list mailing list