[Mono-list] NullException with mcs compiled code that has complex inheritance from interfaces --> mcs bug?

Philippe Lavoie philippe.lavoie@cactus.ca
Wed, 14 May 2003 11:13:36 -0400


This is a multi-part message in MIME format.

------_=_NextPart_001_01C31A2B.644BD0A0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I wanted to see if I could create a unit test for this before Gonzalo =
fixed the problem.

Add this to the nunit-2 list inside CVS please. It has been tested with =
Visual Studio .Net 2003 with no problem.

Philippe Lavoie
=20
   Cactus Commerce           Software Developer  *  D=E9veloppeur de =
logiciels
eBusiness. All Business.          philippe.lavoie@cactuscommerce.com
=20
-----Original Message-----
From: Dominik Fretz [mailto:lists@roboto.ch]=20
Sent: Wednesday, May 14, 2003 11:03 AM
To: mono-list
Subject: [Mono-list] NullException with mcs compiled code that has =
complex inheritance from interfaces --> mcs bug?

Hi

Working on the task to get #D running on mono I encounterd a problem=20
with the complex inheritance of interfaces.

I have two interfaces and two abstract classes.

Interfaces:
ICommand is the base interface
ISubCommand inherit's from ICommand

Abstract Classes:
AbstractCommand inherits from ICommand
AbstractSubCommand inherit's from AbstractCommand and from ISubCommand

Classes:
TestCommand inherits from AbstractSubCommand
So TestCommand iherits 2 times from ICommand, once over=20
AbstractSubCommand->ISubCommand->ICommand and once over=20
AbstractSubCommand->AbstractCommand->ICommand

If i now create a instance foo of TestCommand:
TestCommand foo =3D new TestCommand();

and then call:
((ICommand)foo).Run();

there is a exception.
This only happens if I compile this with mcs.
A exe from windows/.net works on mono.

Find attached a demo source for this problem.

I also submited a bug (#42973) on this issue.

I currently work with mono/mcs from CVS (from 13. May 2003).

Hope someone can find and fix this.

thx

Dominik

------_=_NextPart_001_01C31A2B.644BD0A0
Content-Type: application/octet-stream;
	name="Bug42973.cs"
Content-Transfer-Encoding: base64
Content-Description: Bug42973.cs
Content-Disposition: attachment;
	filename="Bug42973.cs"

dXNpbmcgU3lzdGVtOw0KdXNpbmcgTlVuaXQuRnJhbWV3b3JrOw0K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