[Mono-bugs] [Bug 643377] EqualityComparer<T> Attempts to JIT compile when deployed to the device

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sun Oct 3 11:30:59 EDT 2010


https://bugzilla.novell.com/show_bug.cgi?id=643377

https://bugzilla.novell.com/show_bug.cgi?id=643377#c1


Jonathan Pryor <jpryor at novell.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jpryor at novell.com

--- Comment #1 from Jonathan Pryor <jpryor at novell.com> 2010-10-03 15:30:58 UTC ---
The short answer is that you can't do that; see:

http://monotouch.net/Documentation/Limitations#Value_types_as_Dictionary_Keys

You can only use Comparer<T>.Default/EqualityComparer<T>.Default/etc. for
reference types (possibly, I forget) a predefined set of value types (e.g.
using EqualityComparer<int>.Default *may* work; again, I forget), but
user-defined value types will NOT work.

Removing the linker won't actually fix the problem; the underlying problem is
that EqualityComparer<T>.Default requires runtime generation and execution of
code, e.g.:

http://github.com/mono/mono/blob/master/mcs/class/corlib/System.Collections.Generic/EqualityComparer.cs#L43

Which is akin to doing 'new GenericEqualityComparer<BusinessObjectKey>()' but
constructing 'typeof(GenericEqualityComparer<BusinessObjectKey>)' at runtime;
consequently, Mono's AOT code doesn't "see" the
GenericEqualityComparer<BusinessObjectKey> type, and thus doesn't generate
code.

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list