[MonoDevelop] Widgets gone after MD crash

Lluis Sanchez lluis at ximian.com
Fri Apr 20 11:41:55 EDT 2007

El dv 20 de 04 del 2007 a les 11:01 -0400, en/na Adam Tauno Williams va
> I have a reasonably complex project in MD with lots of GTK widgets;
> only now after MD crashed it won't compile anymore.  Grrr....
> In project options GTK# is enabled and most of the widgets are set to
> export,  and previously they appeared in the widgets palette; now they
> don't appear there and other widgets that use them display "Unknown
> widget...".  (The widgets still appear in the list of widgets to
> export).  I can still view the sort-of-missing widgets in design mode.
> When I attempt to compile the project I get lots of "Could not generate
> code for widgets of type: {widget name} The widget could not be found in
> any referenced library. The generated code may be invalid.]"
> To which I respond: "Dude!  It is in *THIS* bloody assembly!"
> Any ideas how I can splice this thing back into working order?

There is a chicken-egg problem in libraries which use their own widgets.
In order to correctly generate the code for a window, all widgets must
be loaded from the assembly that implements them. MD can't obviously
load widgets from the assembly that it is just trying to generate. What
MD does in this case is to not generate the code and give the error you

This problem is easy to reproduce by doing some change in a window,
cleaning the project and trying to compile. MD will detect that the
window has changed, so the code has to be regenerated, but it will give
that error because the assembly that implements the widget has been
deleted. It might be more complex if there are dependencies between
several projects.

The solution is to build (not rebuild) the project again. Even if you
get the "Could not generate..." error, the project will be compiled and
the assembly will be created, so if you build again the project the gtk#
designer will find the assembly and will be able to load your widget.

Hope that helps,

More information about the Monodevelop-list mailing list