0

I use this code to get some Json text:

     response = await _httpClient.GetAsync(Gurl).ConfigureAwait(false);

the Gurl is correct. This works fine on the IOS simulator, but does not work in Android.

In android it works if I call the page like this:

 Navigation.PushModalAsync(new NavigationPage(new Gallery()));

or like this:

 Navigation.PushAsync(new NavigationPage(new Gallery()));

but does not work if I call the page like this:

 Navigation.PushAsync(new Gallery());

In IOS all 3 work. But I need it to be non Modal, in order to have the Back button in IOS.

The error i get is:

The application is in break mode
Your app has entered a break state, but there is no code to show because all threads were executing external code (typically system or framework code).
System.NullReferenceException: 'Object reference not set to an instance of an object.'

I found the row that is causing problems by adding breakpoints until I found where it does not continue.

call stack says only [external code] and output says this:

04-02 20:50:16.957 D/Mono    ( 4825): Requesting loading reference 1 (of 3) of System.Net.Http.dll
04-02 20:50:16.957 D/Mono    ( 4825): Loading reference 1 of System.Net.Http.dll asmctx DEFAULT, looking for System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
04-02 20:50:16.957 D/Mono    ( 4825): Assembly Ref addref System.Net.Http[0xcc240e40] -> System[0xe78226a0]: 13
04-02 20:50:16.963 D/Mono    ( 4825): Requesting loading reference 2 (of 8) of Mono.Android.dll
04-02 20:50:16.963 D/Mono    ( 4825): Loading reference 2 of Mono.Android.dll asmctx DEFAULT, looking for System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
04-02 20:50:16.964 D/Mono    ( 4825): Assembly Ref addref Mono.Android[0xe7822580] -> System.Net.Http[0xcc240e40]: 3
[0:] Binding: 'isBusy' property not found on 'GalShare.ViewModel.GalleryViewModel', target property: 'Xamarin.Forms.StackLayout.IsVisible'
04-02 20:50:17.118 W/nyname.galshar( 4825): Accessing hidden field Landroid/view/animation/Animation;->mListener:Landroid/view/animation/Animation$AnimationListener; (light greylist, reflection)
04-02 20:50:17.136 W/nyname.galshar( 4825): JNI RegisterNativeMethods: attempt to register 0 native methods for crc643f46942d9dd1fff9.ActivityIndicatorRenderer
04-02 20:50:17.282 D/NetworkSecurityConfig( 4825): No Network Security Config specified, using platform default
Thread started: <Thread Pool> #9
**System.NullReferenceException:** 'Object reference not set to an instance of an object.'
sharkyenergy
  • 3,842
  • 10
  • 46
  • 97

0 Answers0