Bug 58695 - App crash on converting FromsView to NativeView in latest xamarin version
Summary: App crash on converting FromsView to NativeView in latest xamarin version 2.3...
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: unspecified
Hardware: PC Mac OS
: Normal major
Target Milestone: ---
Assignee: Rui Marinho
Depends on:
Reported: 2017-08-10 13:26 UTC by Paul Anderson
Modified: 2017-09-19 09:15 UTC (History)
6 users (show)

Tags: convert, nativeview, ac
Is this bug a regression?: Yes
Last known good build:

Sample (116.73 KB, application/zip)
2017-08-10 13:26 UTC, Paul Anderson
We have modified the sample as per the comments. (140.98 KB, application/zip)
2017-09-04 10:14 UTC, Paul Anderson

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:

Description Paul Anderson 2017-08-10 13:26:42 UTC
Created attachment 24123 [details]

We have converting the Xamarin Forms View to Native view in renderer file. I have attached the simple sample for your reference.
This issue has not occurred in the previous release. We have noticed this issue has occurred in latest Xamarin Forms Version

Run the attached sample for reproduce the reported issue.
Comment 1 Paul DiPietro [MSFT] 2017-08-10 15:46:02 UTC
Thank you for the reproduction. This appears to break as of at least the first 2.3.5-pre. I will mark this as confirmed for now until further investigation.
Comment 2 batmaci 2017-08-25 16:45:49 UTC
Do you have any news on this issue? I am looking for a solution on this also. I tried latest but problem still occurs
Comment 3 Paul DiPietro [MSFT] 2017-08-25 16:48:59 UTC
Nothing at the moment. I will make sure this is on our list of known regressions for 2.4 thus far, however.
Comment 4 Rui Marinho 2017-08-31 14:14:56 UTC
I m not sure this is supported since you basically using reflection in our properties, what's the use case for this?
Comment 5 Rui Marinho 2017-08-31 15:00:12 UTC
Ok simple fix, update to 2.4.0-pre2, and change also your reflection BindingFlags to look for Public properties, BindingFlags.Public.

  _platform = typeof(Element).GetProperty("Platform", BindingFlags.Public | BindingFlags.Instance));

_isplatformenabledprop = typeof(VisualElement).GetProperty("IsPlatformEnabled", BindingFlags.Public | BindingFlags.Instance));
Comment 6 Paul Anderson 2017-09-04 10:14:20 UTC
Created attachment 24543 [details]
We have modified the sample as per the comments.

We have updated our Xamarin.Forms to 2.4.0-pre-2 and also modified the sample as given in the above comments. But the issue still exist. Please check the attached sample2.zip and provide us with the solution.
Comment 7 Paul Anderson 2017-09-18 04:48:32 UTC
The reported workaround is not working on our side. We have prepared the below sample with your work around solution. Please check and update us any other workaround solutions. Waiting for your reply.
Comment 8 David Ortinau [MSFT] 2017-09-18 20:01:49 UTC
Paul, I've tested your new sample with 2.4.0-pre2 and the newly built 2.4.0-pre3 and both work without a crash once I updated all the nuget references to 2.4.0.x.

Note that at least one of your projects in the sample is still referencing which may explain why you still see and error.

If this is not the case or you have more details to add, please reopen the issue for us to consider.
Comment 9 Paul Anderson 2017-09-19 09:15:34 UTC
Thanks, David Ortinau.
It's working correctly on our side.