Bug 18283 - Request to bind extra NSAttributedString constructors
Summary: Request to bind extra NSAttributedString constructors
Alias: None
Product: Xamarin.Mac
Classification: Desktop
Component: Library (Xamarin.Mac.dll) ()
Version: 1.8.0
Hardware: Macintosh Mac OS
: High normal
Target Milestone: ---
Assignee: Aaron Bockover [MSFT]
Depends on:
Reported: 2014-03-10 12:15 UTC by Marek Habersack
Modified: 2015-01-16 18:23 UTC (History)
3 users (show)

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

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 on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Comment 1 Aaron Bockover [MSFT] 2014-03-13 11:27:36 UTC
These won't make it for 1.8.0 as it's not as straight forward as it initially works. The problem is that along with those two selectors, there are a handful of other related ones that should be bound but are not.

Unfortunately those selectors have colliding argument signatures, so a lot of manual binding work will be necessary and there just isn't time right now.

It should be straightforward to add support for the two constructors you care about in your own project until we can get them in the product. I can help with that.

I'll aim for 1.8.1 for a real fix, which shouldn't be too far behind 1.8.0.
Comment 2 Marek Habersack 2014-03-13 12:03:36 UTC
I tried several approaches to add the bindings in my project but all of them resulted in native obj-c runtime crashes. I tried:

 - deriving a class from NSAttributedString and adding a constructor identical
   to what is generated by the bindings compiler. That resulted in an error that
   the 'string' property is defined only in abstract class. Redefining the 
   property in the derived class wouldn't make it go away
 - creating an instance of native NSAtributeString from a managed class that 
   is basically identical to NSAttributeString generated by the bindings compiler
   but uses a different name and then pass the obtained Handle to 
   NSAttributeString (IntPtr)
 - sending a message to NSAttrributeString class to first create an empty object
   and then initialize it, then pass the obtained Handle to NSAttrribtueString

I ended up using the only initWithHTML binding we have and I managed to get it to work only to discover that the extent of HTML and CSS markup supported by NSAttributeString is quite limited and not enough for my needs... :) 

I ended up using WebView (which I hoped to avoid). So, no biggie that they won't make it to 1.8 - thanks for looking into it!
Comment 3 Aaron Bockover [MSFT] 2014-03-13 12:47:29 UTC
FWIW, WebView is awesome on OS X. Don't fear using it. It's a great first class citizen - this isn't Linux or Windows!
Comment 4 Marek Habersack 2014-03-13 13:03:53 UTC
That's the whole problem... If I use WebView on OSX I have to use WebBrowser on Windows... :) THAT was the reason why I wanted to avoid using the browser control :)
Comment 5 PJ 2014-07-25 11:44:18 UTC
Didn't get resolved for 1.8.1, moving off milestone. I'm moving to '---' as I'm not sure of the new target.
Comment 6 Timothy Risi 2015-01-16 18:23:37 UTC
Fixed by 8c9e32496e1c0f7033904b4014720cda64a1f612