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 10558 [details]
Exception screen shot
Am storing the Reflected properties of an underlying collection into my own Dictionary<string, propertyinfo> for some internal use.
When i try to use the generic methods "GetGetMethod()" with the Propertyinfo stored in the dicitonary am getting Null Reference exception.
When i examined further deeply i saw that
System.Reflection.Memberinfo had GetMethod = null.
The logic used to store the reflected properties ->
1.Converting the Underlying collection to IEnumerable
2.Getproperties from Enumerable.GetType() Stored --> Result is stored inside the Dictionary<Property.Name, Property>
I have attached the screenshots of the expection.
FYI this worked fine before last update i think this is a break and this reproduces both in Simulator and Devices. The same set of code works fine in Android as am sharing reflection logics across platforms.
System Information : Xamarin.IOS 18.104.22.168 Business version.
Am sorry i couldn't reproduce the same issue in a simple sample. It would be great if you come up with some fix or workaround as we are near Product release it would be harder to bear the delay.
It looks like you have the linker enabled (maybe "Link all" ?) and that member (the getter) is being removed because it's not used by the application.
Can you attach your build logs ?
Please add "-v -v -v -v" to the Project's options, Additiona touch arguments) and do a Rebuild to get the logs and then attach them to the bug report.
Created attachment 10565 [details]
Yes you're right my build options has linker enabled "Link All " when i added the monotouch arguments as like you recommended it's working as expected. I have attached the Build logs for your reference please check it out.
Created attachment 10566 [details]
Updated Build Logs as per your comment
Am sorry please ignore the last update it was built using Lineker options "Dont Link" please use the Updated Build Logs. Am still getting those Null Reference Exception from MethodInfo.
Your build logs are not helpful since you did not do a "Rebuild" (it did not run mtouch for a Build, since it was already done). As such I cannot see which options were used.
OTOH the NRE is perfectly normal if you use "Link all" (1). When you use this option you are responsible to ensure your code (not the SDK code) is linker safe, i.e. that everything can be reached by static analysis.
That can be done with additional code (i.e.making sure the getter are used), using the [Preserve] attribute or an XML file. Anything not used (or preserved) will be removed by the managed linker (it's its job to do so and you're asking it to run on _all_ code).
1. this is why the default option is "Link SDK", i.e. that the linker is only applied to the SDK code that Xamarin ships (and that user code is not linked). That removes almost all needs for extra code/definitions and still gives great space savings;
2. Using "Link all" in Xamarin.Android would give you the same result;