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 21382 [details]
app with reproduce and a crash log
NSTextField with custom NSFormatter crashes application when compiled in Release mode after update to Xamarin.Mac 126.96.36.199
Works in Debug mode. Worked more than half a year before the update.
How to reproduce:
1. Create subclass of NSFormatter
2. Add NSTextField to the UI
3. Add NSFormatter to created text field (no matter how to add: manually with code or IB)
4. Compile and run in Release. Input any character into created text field.
Application crashes (crash log and sample app in attachments)
In 3.2 a few defaults in Xamarin.Mac were changed:
and one of them (use of the static registrar) is the culprit here.
You can swap back to the old behavior by adding
to your Project Options -> Build -> Mac Build -> Additional mmp arguments section.
I'll have to look into what the static registrar isn't playing nicely with NSFormatter subclasses.
GetObjectValue is defined as this:
bool GetObjectValue (out NSObject obj, string str, out NSString error);
and is called with "pointer, pointer, NULL":
frame #1: 0x00000001096e85a6 NSFormatterCrash`::-[CustomFormatter getObjectValue:forString:errorDescription:](self=0x0000610000037680, _cmd="getObjectValue:forString:errorDescription:", p0=0x00007fff568597e0, p1=class name = NSBigMutableString, p2=0x0000000000000000) at registrar.m:37453
the problem is that C# requires "out" parameters to be non-null, so the static registrar assumes the same thing, and does generates this upon returning from the managed function to copy the out parameters back to native code:
-> 21008 *p2 = (id) handle2;
which crashes, since "p2 = NULL".