Bug 55885 - NullReferenceException thrown while using Platform property
Summary: NullReferenceException thrown while using Platform property
Status: RESOLVED NORESPONSE
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Paul DiPietro [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2017-05-02 11:59 UTC by Paul Anderson
Modified: 2017-06-16 18:24 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

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:
Status:
RESOLVED NORESPONSE

Description Paul Anderson 2017-05-02 11:59:41 UTC
We are using following code snippet for converting a view from Xamarin.Forms to native iOS/Android.

internal static IVisualElementRenderer Convert(Xamarin.Forms.View source, Xamarin.Forms.VisualElement valid)
        {
            IVisualElementRenderer render = (IVisualElementRenderer)source.GetValue(RendererProperty);

            if (render == null)
            {
                render = Platform.CreateRenderer(source);
                source.SetValue(RendererProperty, render);
                if (valid != null)
                {
                    var p = PlatformProperty.GetValue(valid);
                    if (p != null)
                    {
                        PlatformProperty.SetValue(source, p);
                        IsPlatformEnabledProperty.SetValue(source, true);
                    }
                }
            }

            return render;
        }

After updating to the latest Xamarin.Forms version( 2.3.5.235-pre2) we were unable to access the PlatformProperty.GetValue() method.

 Is that the  property has been removed and Is there any other way to achieve our requirement ?
Comment 1 Paul DiPietro [MSFT] 2017-05-08 17:25:44 UTC
Can you please upload a small reproduction to see exactly what you're doing aside from that code being used? This worked for you in 2.3.4?
Comment 2 Paul DiPietro [MSFT] 2017-06-16 18:24:41 UTC
This issue will be closed due to a lack of response for over a month. Please reopen this and attach a minimized reproduction project if the issue still exists as of the latest prerelease or nightly build.