question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NRE on Android when a new activity is opened

See original GitHub issue

This issue has been observed on Android 9 and 10 The problem exists on the current master branch as well as v7.2.1046

The issue is reproducible in the sample app that is part of this project too. I have attached a video showing steps to reproduce the issue along with the code I modified to log the exception.

Essentially Android creates a new activity which I expect should return the app to the initial page. I have also tried creating this scenario with Xamarin Forms and Rg.Plugins.Popup (without Prism). In this case, the navigation seems to work fine.

System.NullReferenceException: Object reference not set to an instance of an object.
  at Prism.Common.PageUtilities.GetCurrentPage (Xamarin.Forms.Page mainPage) [0x00002] in /_/src/Forms/Prism.Forms/Common/PageUtilities.cs:255 
  at Prism.Plugin.Popups.PopupPageNavigationService.DoPush (Xamarin.Forms.Page currentPage, Xamarin.Forms.Page page, System.Nullable`1[T] useModalNavigation, System.Boolean animated, System.Boolean insertBeforeLast, System.Int32 navigationOffset) [0x00218] in 

Screen Recording 2020-09-24 at 2.51.09 PM.mov.zip

samples.zip

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
pravincarcommented, Sep 29, 2020

@jbachelor I’ve seen the problem that you have described in some scenarios too. However, it is different from the issue I have reported here. I have implemented a workaround in my app to get rid of the Task.Delay.

Create a popup pop observable which subscribes to the PopupNavigation instance in Rg.Plugins.Popup

public IObservable<System.Reactive.EventPattern<PopupNavigationEventArgs>> PopupPopObservable
            = Observable.FromEventPattern<PopupNavigationEventArgs>(
                (h) => PopupNavigation.Instance.Popped += h, (h) => PopupNavigation.Instance.Popped -= h);

Wait for the popup to get cleared before any further navigation

await PopupPopObservable.Take(1);

This may work for you too.

0reactions
dansiegelcommented, Feb 28, 2021

@pravincar as this has been reported by both @jbachelor and @jdarmody as not happening anymore I’m going to close the issue. If it continues to please let me know and we’ll reopen the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tasks and the back stack
A new activity, by default, is launched into the task of the activity that called startActivity() . It's pushed onto the same back...
Read more >
Activity opened twice - android
This app lets its user review certain items and comment on them. Activity A is started when the app is launched. If the...
Read more >
Android development retrofit with kotlin. You can now extract
Android development retrofit with kotlin. You can now extract the business logic code to the Kotlin Multiplatform shared module and make it ...
Read more >
Home - NRI
Absolute trust is an Nri loan againest property from sbi. Total reliability is an NRI car loan from sbi. Peace of mind is...
Read more >
Paypal closed my account. This one almost got me
This was so that I could open a new account. In the left-hand pane, click "Activity … Transfer money online in seconds with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found