[Mono-list] Mono 2.0 issues in Ubuntu - where is the problem and how will it be fixed?

Atsushi Eno atsushieno at veritas-vos-liberabit.com
Fri May 11 16:38:35 UTC 2012


IBBoard wrote:
> But if I force my app to run under the 4.0 runtime using a switch then
> it works without error (as far as I've seen). That implies that there
> might something that could be handled, possibly by Mono or possibly by
> Ubuntu if it isn't appropriate for Mono itself to do it.
This does not imply there is something that could be automatically handled.
It is just because some code is compiled to use Type.op_inequality() 
(which only exists in 4.0) in gtk-sharp.dll, while the app entrypoint 
loaded 2.0 mscorlib.dll. It is CLI design that only one mscorlib is loaded.
If you run your app as in 4.0, the entrypoint loads 4.0 mscorlib and 
Type.op_inequality() is there, hence that error never happens.
The mono runtime is not at the position to determine whether your app 
won't run on 2.0 or not.

> Someone in Ubuntu might have decided that GTK# for .Net 4.0 only might
> have been a "feature" and hence not a bug when 2.0 apps won't work,
> but it seems like a very badly planned and unnecessary change.

That sounds wrong to me. Reasons:
- ABI compatibility is supported only each of 2.0 and 4.0. No one 
(Microsoft or Mono) assured cross-ABI compatibility.
- Whether Ubuntu supports 2.0, 4.0 or both, especially for each 
"application" package (here gtk# is an "application" as compared to the 
mono "framework"), is totally up to its target apps. They don't ship 
primary apps in 2.0, so they don't ship their deps in 2.0 profile.
- It is like Windows and .NET 1.1. People don't complain that Microsoft 
does not ship .NET 1.1 in the latest OSes. By not shipping 1.1, any 1.1 
apps could be broken like yours.

> The script I have appears to work for now, but I'd prefer a better way
> to detect when to add the fix to the command-line (something that does
> feature detection rather than OS detection, and so will work across
> derivatives and other OSes that go the same route). If anyone has any
> suggestions or scripts then I'd be glad to hear them.
> Recompiling for .Net 4 or rebuilding GTK# just for the sake of Ubuntu
> just seems unnecessary.
2.0 will be deprecated and will vanish from mono later, like we killed 
1.1 profile in the past. Building for 4.0 is absolutely the right direction.

And this rather sounds like "I don't want to build 2.0 packages, so you 
build 2.0 packages for me instead" ...

Atsushi Eno

> Thanks,
> IBBoard
> On 11 May 2012 09:00, Atsushi Eno<atsushieno at veritas-vos-liberabit.com>  wrote:
>> Hello,
>> To my understanding, Ubuntu does not support GTK# for .NET 2.0 based mono
>> runtime, which is not a bug. You are trying to run an app with insufficient
>> software components on an OS. If you want to use the feature that the OS
>> does not provide, you'll have to provide that by yourself, like it wouldn't
>> make sense to bug Microsoft that WP7 does not ship with System.Data.
>> (In other words, while .NET 2.0 could be the LCD, gtk# on .NET 2.0 is not .)
>> I believe you could build and provide gtk# which is based on .NET 2.0
>> profile. Putting package for public would help Ubuntu users. Or
>> Ubuntu/Debian people may already have such packages apart from official
>> repos. AFAIR there are some "2.0-cil" packages in Ubuntu.
>> Atsushi Eno
>> IBBoard wrote:
>>> It appears there is a problem with running older .Net apps on the latest
>>> versions of Ubuntu. If you compile for .Net 2.0 (perhaps because that is
>>> your lowest common denominator, because you are working cross-platform and
>>> you know some people will still be using WinXP without the huge .Net 3/3.5/4
>>> updates) and run it on Ubuntu then you currently get an instant crash with a
>>> message like "Missing method System.Type::op_Inequality(Type,Type) in
>>> assembly /usr/lib/mono/2.0/mscorlib.dll, referenced in assembly
>>> /usr/lib/mono/gac/gtk-sharp/"
>>> It looks like this problem is quite prevalent and problematic
>>> (https://bugs.launchpad.net/ubuntu/+source/mono/+bug/882501,
>>> http://stackoverflow.com/questions/10473868/mono-gtk-hello-world-failing-missing-method,
>>> and the rest of Google). The two fixes people have are "recompile" (only an
>>> option if you're *only* targeting Ubuntu and want to use v4.0) or "add the
>>> --runtime=v4.0 switch" to force a 2.0 app to run as 4.0.
>>> Based on the assembly mentioned in error and what I've picked up online,
>>> am I right in understanding that this is a purely Ubuntu-caused problem
>>> because GTK# is now build with the .Net 4.0-compatible compiler? Is there
>>> any way they can fix this, or are we stuck with it? And are there any
>>> sensible and non-hackish ways to work around this in the meantime?
>>> I'm working on my own Bash wrapper at the moment to fix this only when
>>> necessary
>>> (http://dev.ibboard.co.uk/repos/IBDev-IBBoard.WarFoundry.GUI.GTK/files/tip/WarFoundry.sh)
>>> but I'm sure there must be better ways to do it.
>>> Thanks.
>>> _______________________________________________
>>> Mono-list maillist  -  Mono-list at lists.ximian.com
>>> http://lists.ximian.com/mailman/listinfo/mono-list
>> _______________________________________________
>> Mono-list maillist  -  Mono-list at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-list

More information about the Mono-list mailing list