Bug 38967 - Problem with adding selfmade widget library
Summary: Problem with adding selfmade widget library
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: GTK# Designer ()
Version: 5.10 (C6SR3)
Hardware: PC Windows
: Low normal
Target Milestone: master
Assignee: Bugzilla
Depends on:
Reported: 2016-02-20 16:36 UTC by Nebojsa
Modified: 2017-05-18 11:04 UTC (History)
4 users (show)

Is this bug a regression?: ---
Last known good build:

Screenshot of that error when i try to add my widget to gui builder. (252.96 KB, image/png)
2016-02-20 16:36 UTC, Nebojsa

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report for Bug 38967 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Nebojsa 2016-02-20 16:36:21 UTC
Created attachment 15112 [details]
Screenshot of that error when i try to add my widget to gui builder.

Description of Problem:

I created GTK C# project in Monodevelop(Xamarin studio 5.10). And then like on tutorial on web i created a created new library project inside. Created widget. Built project, by using plus "+" button in gui toolbox i added that library that i created. My widget appeared in toolbox. But when i want to drag that widget on gui i get following error:

'The widget 'LibraryName.WidgetName' could not be found.'

I tried multiple times to create new libraries but every time i get that error. Pls fix that problem. Bellow(also in attachment too) is screenshot of that error when i try to add my widget to gui builder:

Comment 1 David Karlaš 2017-03-15 06:55:57 UTC
This seems to be working for me, can you try updating to latest version?
Comment 2 hiwatari.seiji 2017-03-15 07:13:50 UTC
I was able to easily reproduce it by:

- Create new gtk#-2.0 project: libTestWidget
- Set Project to type "Library"
- Remove "Program.cs"
- Delete MainWindow
- Add new Widget "TestWidget"

- Create new gtk#-2.0 project
- Add >assembly reference< to libTestWidget
- Try to add it to ui in designer

When libTestWidget is in the same solution and linked by Project Reference instead of assembly reference, it works as expected.
Comment 3 David Karlaš 2017-03-15 09:19:01 UTC
Hi Seiji,

I think you have different problem, that custom widget doesn't appear at all in toolbox, right?
In that case I open pull request: https://github.com/mono/monodevelop/pull/1953

Still need info(if it's reproducible with latest version) for original bug where exception was thrown when trying to add custom widget.

Comment 4 Nebojsa 2017-03-15 10:20:38 UTC
Hi all,

I found work around. In MainWindow.cs anywhere in code create library object(no need reference, just create new object) and rebuild project and widgets will be able to be added to GUI. 

For example in hiwatari.seiji@gmail.com project:

using System;
using Gtk;

 public partial class MainWindow : Gtk.Window
	public MainWindow () : base (Gtk.WindowType.Toplevel)
		Build ();
		new libTestWidget.TestWidget (); // added this line

	protected void OnDeleteEvent (object sender, DeleteEventArgs a)
		Application.Quit (); 
		a.RetVal = true;
Comment 5 hiwatari.seiji 2017-03-16 09:24:22 UTC
Hi David,

it did not show up, but I thought that was more or less intended.
Therefore, I manually added the assembly with the ToolBox's plus button.
The widget did then show up in the ToolBox, but dragging it into the designer got me the error described in this bug.

I just cloned the monodevelop repository and built monodevelop- from source. (could not get master to compile)
For me, the bug (described in this report) also exists in that version.
Comment 6 Lluis Sanchez 2017-05-18 11:04:52 UTC