[Mono-list] Error while casting a struct to an interface

Dwivedi , Ajay Kumar AjayKumar.Dwivedi@dresdner-bank.com
Mon, 1 Jul 2002 12:39:55 +0100

> I got a compiler error telling that I cannot convert a struct to an
> interface through casting. The struct actually implements the 
> interface
> and I try to cast it directly (although the 'as' way doesn't work
> neither): 
> ISomeInterface isObject = (ISomeInterface) isObject;
This is surely a bug in the Compiler. The interface implementation
information is not written to the output file for structs.

For example,
	public struct Mystruct: IMyInterface
	public interface IMyInterface

The monodis of output file has
  .class public sequential ansi sealed beforefieldinit Mystruct
        extends [mscorlib]System.ValueType

whereas it should also have

	implements IMyInterface

	Please file a bug report.