[Gtk-sharp-list] Strange compiler errors and runtime crashes on Windows
monoman at gmail.com
Wed Apr 18 09:37:56 EDT 2007
Hi Chris, inline
On 4/18/07, Chris Lee <chris at lee-gertner.net> wrote:
> Hi --
> I'm having new problems in my port of Gtk# code from Linux to Windows.
> The first scary thing is that I was getting compiler errors (in Windows)
> Plot.cs(116,36): error CS0029: Cannot implicitly convert type
> `StripChart.Plot.plotSurface' to `Gtk.Widget'
> where plotSurface is a Gtk.Widget (compiled in a separate .dll before).
> I was also getting a strange error in some boilerplate ButtonEvent code:
> plotSurface.ButtonPressEvent +=
> new Gtk.ButtonPressEventHandler(OnButtonPress);
Looks like you are having versioning problems, And example, you are
using a lib A, version 188.8.131.52, and a lib B that referenced a version
184.108.40.206 of lib A, unless you configure version-policies, things won't
match when compiling a lib/exe C that uses both. This is particularly
easy to happen when you compile with VS.NET generated AssemblyInfo
sources, that set the version number like 1.0.0.*, what means the
compiler will generate a new number on each compilation for the
Just set fixed version numbers, or you'll have to recompile/reinstall
> gave me the error:
> Plot.cs(126,17): error CS0019: Operator `+' cannot be applied to operands of
> type `Gtk.ButtonPressEventHandler' and `Gtk.ButtonPressEventHandler'
> The same code compiles fine under mono-220.127.116.11 in Edgy-Eft Ubuntu linux
> (on Windows, I'm using the latest Mono/Gtk-sharp 18.104.22.168 windows
> distribution from Novell).
Same thing here. Check the versions exposed/referenced on all libs,
some mismatch is happening. If you'are using packaged libs, versioning
is normally taken care if all pieces come from the same place, but if
things come from various sources, look for matched packages.
> I'm wondering if this was somehow caused by adding and removing the
> different Gtk# runtimes and SDKs. I've made sure I have only the basic
> mono-installer version now, but I'm still getting this error.
> Also, when I comment-out the code causing the compile errors I'm getting
> many run-time crashes in the unmanaged Gtk code. I can clear some of
> them by trial and error, by doing things like changing a class from
> subclassing a Gtk.VBox to containing a Gtk.VBox as a member.
> I'm wondering if I am seeing differences having to do with how quickly
> my temporary objects are getting garbage-collected or something -- I'm
> running the windows stuff in a virtual machine with limited memory
> (WinXP, running under Parallels, under Linux).
> Or maybe the runtime crashes have something to do with the compiler
> Gtk-sharp-list maillist - Gtk-sharp-list at lists.ximian.com
Multiple installation should not be a problem as they install versions
in separate places, and the GAC is versioned (keeps various versions
of the same library), but mismatched packages installed, or your own
libs compiled against a version and then referecend with other
versions is a sure source of problems (if all subprojects are in the
same solution vs;net/SD calculates the dependencies and recompiles all
that is needed).
Hope it helps,
Rafael "Monoman" Teixeira
"The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all
progress depends on the unreasonable man." George Bernard Shaw
More information about the Gtk-sharp-list