Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Calling backstackManager.finalizeScopes() twice results in an unexpected error message #150
I'm getting the error:
I'm not sure if it's a bug or a misconfiguration on my side.
Here's my RootActivity.kt:
Inside AuthFragment.kt I have this:
After pressing back button while on AuthFragment I get the error in the title. The exception happens at line
I was hoping I'd never see this error message
Theoretically I added this assertion to signal that there is a discrepancy between the scopes that the ScopeManager keeps track of, and the scopes that can be re-constructed from the Backstack's history stack.
I'd also think this is not possible, but apparently it is.
The exact message claims that the History stack is able to retrieve a scope from the history that doesn't exist inside the ScopeManager. But I might need to add a better error message, I really wasn't expecting this to ever occur...
Do you have a sample project, or is this simple sample already reproducing it with backstack delegate + fragments?
We've been using
Theoretically if you need to revert, this seems to be an issue with dispatching
So the version without
....I really need to know how to reproduce this to proceed, though. I have a bunch of tests, this never happened before. >.<
referenced this issue
Mar 4, 2019
Actually, I have an idea.
Is there ANY chance that for SOME REASON you're calling
For example, the fact that your sample code seems to register for automatic lifecycle callbacks, AND also invokes
I must admit that I didn't think of checking for scope finalization twice, this needs a better error message.
In your app though, the solution is to either remove
Just checked with the scoping sample. The error doesn't happen. However the sample uses Navigator instead of BackstackDelegate. Also it uses explicit scopes I think. Not sure if that matters. I changed to implicit by removing ScopeKey.Child implementation from WordScope. I don't know if that's enough to make it implicit. Sorry, I'm still struggling to understand implicit and explicit scopes. But I got the following error:
I'll try to produce a sample later.
The only thing I can't track in there are
So it tracks
From my perspective, it's a mistake of my API that I allow this.
Anyways, thanks for finding a bug. You should be getting a reasonable error message when this happens, instead of "hello the world exploded please hold".
I had to figure out how I'd want to handle this, especially what to do with scopes after they're finalized; now I'll swallow multiple calls to
So you will no longer get this cryptic error message in 1.13.4 (f0101f3).