[Mono-dev] Event handler assigment possible bug?

Jonathan Pryor jonpryor at vt.edu
Tue Sep 20 07:57:30 EDT 2005


On Mon, 2005-09-19 at 11:09 -0500, Sunny wrote:
> Anyway, the following code compiles OK with mono 1.1.9 on SuSE 9.3,
> but it fails to compile under .Net, and according the ECMA C# spec,
> possition 8.7.5. (Events), .Net behaviour is the right one, i.e. this
> code should fail to compile.

>               //This line fails under .Net, as according the
>               //ECMA specs (8.7.5):
>               //"An instance of a delegate type encapsulates
>               //one or more callable entities."
> 
>               test.MyEvent += MyHandler;

It's not a bug, it's a feature!  :-)

mcs implements most of the C# 2.0 features except for Generics (which
are in gmcs).  The "bug" you're seeing is a C# 2.0 feature, type
inferencing and implicit delegate conversion.

If you need to target C# 1.1 for .NET compatibility, add the
-langversion:ISO-1 argument to your mcs command line.

 - Jon





More information about the Mono-devel-list mailing list