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.
MT 5.0.1, MD 2.8.2
I have had to re-export the _original_setCoordinate method in my descendant MKAnnotation as it appears the linker removes the one from MT runtime.
This is similar to the following issue except that I think it is because the linker is removing the fix: https://bugzilla.novell.com/show_bug.cgi?id=686788
To fix I have copied the internal SetCoordinate along with Export attribute into my descendant class, and then applied the Preserve(AllMembers=true) to my class.
[Preserve(AllMembers = true)]
public partial class PropertyAnnotation : MKAnnotation
internal void SetCoordinate (CLLocationCoordinate2D coord)
this.Coordinate = coord;
Perhaps a Preserve is required on the MT MKAnnotation?
Note: I also had tried with "Do not link" and all that did was cause a crash with no discernible debug information on why it was crashing. Compiling with "Link SDK" then showed helpful exception information along with a break point.
There's likely something else because "Do not link" should not crash if this was only linker related. I'll look into it. Thanks
Would it make sense to have the "Export" attribute also apply the same behaviour as the "Preserve" attribute for those fields (if it isn't already)?
Yes it probably is a different error for the "Do not link". If you require something to reproduce that one let me know and I'll see if I can get an example for it.
WRT [Export], no since it would effectively disable linking monotouch.dll adding megabytes to many applications. But there are already rules to avoid removing required [Export]. Anyway first thing is to figure out why it crash without linking - it definitively should not. Once that's identified the linker issue, if it still exists, will likely be easy to pin down.
I'll try to duplicate the issue with the original test case (which is helpful if it was a regression). If I can't duplicate either case (linked or non-linked) then I'll contact you. Thanks!
I can't duplicate a crash without linking (using the old sample). Could you provide me a sample that does so ?
That member will now be preserved by MonoTouch (if the type is used) since it's called from ObjectiveC and out of the linker reach. In the mean time your workaround is fine.
Please open a new bug report if you can duplicate (and attach a test case for) the crash that occurs without linking - it's unrelated to this case. Thanks!