Upgarding to xamarin forms nightly version causes null reference exception

EswaranEswaran INMember ✭✭
edited December 2018 in Xamarin.Forms

We have created a custom control and used customrender for converting it forms to native. We faced null reference exception only when using the 3.5.0.979221-nightly version and it works fine when using 3.3.0.912540. On further analysis we found that the null reference exception occurs in all Xamarin forms nightly version. Can any one please explain the difference between the Xamarin forms nightly version and normal xamarin forms version. We don't know what the reason for this. Could anyone please help to resolve the issue. The sample code is given below

public 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);
var p = PlatformProperty.GetValue(valid);
PlatformProperty.SetValue(source, p);
IsPlatformEnabledProperty.SetValue(source, true);
}

        return render;
    }

I have also attached the image showing the issue.

Answers

  • GaetanFGaetanF USMember ✭✭✭
    edited December 2018

    Try clean your solution, quit VS, delete the /obj and /bin folders everywhere in your projects then restart and rebuild.

  • LandLuLandLu Member, Xamarin Team Xamurai

    @Eswaran nightly builds is not a stable version, you should use release version to develop your project. Please note that
    Nightly builds have passed a suite of automated tests, but otherwise have received no additional testing.

    It could occur some unknown issues, if you want to try some new features.

Sign In or Register to comment.