Bug 12006 - Gui Designer Forgets Binding from Designer File to User Class
Summary: Gui Designer Forgets Binding from Designer File to User Class
Status: NEW
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: GTK# Designer ()
Version: 4.0.4
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-04-27 12:12 UTC by Matthew Trumbell
Modified: 2014-08-06 13:33 UTC (History)
3 users (show)

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


Attachments
GuiBuilderProject.cs Patch (18.13 KB, patch)
2014-08-06 13:29 UTC, Isamu1357
Details


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 12006 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:
Status:
NEW

Description Matthew Trumbell 2013-04-27 12:12:17 UTC
On a previously working project, when I attempt to open certain windows or dialog widget designers by double clicking on them in the User Interface area, I get the "Bind Widget Design" dialog. This dialog states:

  The widget design Blah.MyWindow is not currently bound to a class.

It then offers me the option to bind to an existing class. Doing so seems to have no effect. It also offers me the option to create a new class. This results in the designer blanking out the name of the widget designer file (what was formerly Blah.MyWindow.cs becomes ".cs"). This is pretty much an unrecoverable state without manually fixing all the project files.

Further, when a widget gets into this state, you cannot properly assign event handlers on the widget. For instance, if I select the user class for the widget, then select Designer on the bottom tab bar, I can see the designer and make changes. But if I select a button on the widget and try to assign an action for the clicked event through the property window on the signal tab, I get the following error:

  The class bound to the component "Blah.MyWindow" could not be found. This may be due to syntax errors in the source code file.

I looked through the source files and found no obvious syntax errors. I also compared "good" widget files (where stetic seems to remember the bindings to the user class) and found no obvious differences between the good and bad widgets.

Finally, if I reopen my solution and re-try, I can sometimes get xamarin to open the designer for the widgets properly and assign event handlers.
Comment 1 Matthew Trumbell 2013-05-02 23:20:34 UTC
Whenever the "Bind Widget Design" dialog comes up, the following is logged to the ide log for Xamarin:

(XamarinStudio:5625): libglade-WARNING **: Could not load support for `gnome': dlopen(libgnome.so, 9): image not found

There is no trace of libgnome (.so, .dylib, or otherwise) on my OS X system and it doesn't seem to be included in Mono. This error does not appear when Xamarin successfully loads the designer, only on the files where Xamarin forgets the binding.
Comment 2 Gonz 2014-03-24 04:39:29 UTC
I have the same problem.  I am able to open a copy of the source files from a different location without problems.  Xamarin Studio must have a state file somewhere for each project. (?)

Did you ever find a solution?
Comment 3 Matthew Trumbell 2014-03-24 09:24:57 UTC
I did not find a solution. Instead, I unbound from stetic and took control of my UI files myself. It was a slightly painful process, but to stetic's credit, the files it generates are pretty straightforward and easy to edit. stetic is great when it works, but little issues like this made it more trouble than it's worth. I'm quite happy without it.
Comment 4 Gonz 2014-03-26 04:59:45 UTC
On Windows, I was eventually able to eliminate the error by deleting this folder:

C:\Users\<YourName>\AppData\Local\XamarinStudio-4.0\Cache

And I was able to reproduce the bug using these steps:

1. Create a new widget (e.g. TestWidget) using the Xamarin Studio visual designer.
2. Put a button on the widget, save it, and run the application.
3. Using the Xamarin Studio "Solution" view, create a folder and drag the TestWidget.cs file into that folder.
4. Save all, rebuild, and run the application again.  It works fine, and at this point the visual designer is still working just fine.
5. Close Xamarin Studio, then restart it and reopen your project.  If you try to open TestWidget in the visual designer, you now get the "Bind Widget Design" bug.

Delete that cache folder, and the problem goes away.

Now, since XAMARIN HAS NEVER FIXED ANY BUG EVER in my history of using their products, I'm not sure why I'm bothering to give these detailed steps.  But at least you've got a workaround.  :-)
Comment 5 Isamu1357 2014-08-06 13:29:11 UTC
Created attachment 7605 [details]
GuiBuilderProject.cs Patch

This seems to work around the issue of the implicit cast operator for FilePath.
Comment 6 Isamu1357 2014-08-06 13:33:14 UTC
The attatchment should resolve the issue. It does not seem to be an issue with the binding or MonoDevelop not finding the file, but an issue with the cast operator for FilePath. I have not looked into the cast issue further, but I hope this will solve some of the headaches for those who have hit this issue.