[Mono-dev] another corcompare patch to hide extraneous"IsVirtual"differences

Kornél Pál kornelpal at hotmail.com
Fri Nov 4 04:24:35 EST 2005


Now I understand why you mentioned internal interfaces.

My problem is that IsVirtual affects IL code emitted by compilers for source
code that reference assemblies that will result in different IL code when
compiling on MS.NET and when Mono. The difference is "call" or "callvirt".
Altough you are treating this difference as a non-practical difference this
is a big difference.

When a non-virtual public method implements an interface it will be "newslot
virtual final". This is treated as equal to a method without any of these
modifiers and will be called using "call". As a result there is no

So I think the solution is to compare "virtual" but treat "newslot virtual
final" equal to non-virtual. This is something very similar to your original
idea. And there should be no checks for interface things in this comparsion.

The only problem is that the above is the behavior of MS csc.exe while mcs
generates different metadata and IL code.:) As MS csc.exe behavior is the
expected as it makes possible some relaxations of corcompare I'm going to
report it as a bug.

To avoid the override behavior problem I described in my previous message.
Note that this is an important difference and in fact it covers 4 cases if
you invert MS.NET and Mono and/or invert private syntax and public syntax.

If we don't want to force interface method implementation syntax to be the
same corcompare still has to treat public methods of a type different from
the methods that implement interface methods. Of course they can be the same
method but this single method should be accepted by corcopare for both
public and interface method if and only if the attributes are compatible
with both the public method and the interface method. non-virtual ==
"newslot virtual final" in this case as well. I think the easiest way to
implement this is to check the publics method and the interface methods as
separate methods.


----- Original Message -----
From: "Atsushi Eno" <atsushi at ximian.com>
To: "Kornél Pál" <kornelpal at hotmail.com>
Cc: "mono-devel mailing list" <mono-devel-list at lists.ximian.com>
Sent: Friday, November 04, 2005 6:55 AM
Subject: Re: [Mono-dev] another corcompare patch to hide

> Hi,
> Kornél Pál wrote:
>> Hi,
>> Of course people assuming unusual things or depending on bugs will suck
>> anyway and I usually don't support their nonsense but if we allow this
>> difference different IL code will be generated from the same source code
>> on
>> Mono and MS.NET because the referenced assemblies would have different
>> API.
>> Having internal interfaces is not a problem. The problem is when the
>> virtual
>> status of a publically visible (public or protected) method differ
>> between
>> MS.NET and Mono as that results in different IL code and behavior on Mono
>> and MS.NET. So IsVirtual has to match MS.NET without regard to IsSealed
>> or
>> to anything else.
> Having internal interfaces affects on IsVirtual value. Thus we can't
> just expect exactly same MethodAttributes values.
> Or you might be suggesting that corcompare should check if each method
> implements internal interfaces or not, but it will result in significant
> performance issue for that too-niche purpose.
> Anyways it would be time to introduce some "options" in corcompare
> tools to check both practical API compatibility and to satisfy
> those canonicalized people who think everything must be equivalent
> to MS.NET. There is another discussion that we don't need ComVisible
> attribute check, Serializable on enums/delegates, and so on.
> Atsushi Eno

More information about the Mono-devel-list mailing list