Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
Created attachment 10598 [details]
Duplicates the issue
I have implemented an NSFormatter based on the example here to limit the length of an NSTextField:
Using this in Xamarin.Mac 1.12 causes any text in the field to be lost completely.
This works fine in Xamarin.Mac 1.10.
To test, the example app attached should have text in both text boxes when started. In Xamarin.Mac 1.12, only the second text box has an initial value, and when you type in the first field then move focus to the second field, the text is lost.
I was able to get the text field to work with the formatter without blanking out when changing focus by changing:
public bool GetObjectValue(ref IntPtr obj, IntPtr value, ref IntPtr error)
public bool GetObjectValue(ref NSObject obj, NSString value, ref IntPtr error)
I also created a new bug (https://bugzilla.xamarin.com/show_bug.cgi?id=28696) to get the rest of the NSFormatter methods bound so they don't have to be manually exported.
Ah, that's great! I tried the same also, but used "ref NSString error" for the last parameter (which it should be I guess?), which causes a crash.
Thanks so much - this certainly will get me going for now.
I just tried changing the error paramater to ref NSString and got a crash as well. If you change it to "out NSString error" it works again (the "ref NSObject obj" also can be done as "out NSObject obj" if desired)
Aha, you are awesome! I missed that detail of the api and totally makes sense why I was having problems.