Bug or by design? Xamarin.Forms.Forms.Context is null

YuMengYuMeng USMember

I've reported the issue in the Xamarin.Forms annoucement thread but it doesn't seem to get any attention so I am creating a new thread for it.

After upgrading to 1.1.1, Xamarin.Forms.Forms.Context gives back a null value for context1. Android.App.Application.Context still works.
var context1 = Xamarin.Forms.Forms.Context; var context2 = Android.App.Application.Context;

Before the upgrade, context1 holds the following value

context1    {DotnetCatalog.Droid.MainActivity}  DotnetCatalog.Droid.MainActivity

Posts

  • CraigDunnCraigDunn USXamarin Team Xamurai

    when are you checking the value of Forms.Context?

  • YuMengYuMeng USMember

    Before the first page is shown. My view model for the page uses dependency service to read an android asset file. Xamarin.Forms.Forms.Context.Assets used to work.

  • StephaneDelcroixStephaneDelcroix USInsider, Beta ✭✭✭✭

    since 1.1.1, Context is only set on SetPage(). This causes some issues as being unable to do a Device.BeginInvokeOnMainThread() or simply trigger property changed event on BindableObject. This is known as a problem and will be worked on.

Sign In or Register to comment.