Closed Galle94 closed 5 years ago
Sorry, i didn't seen your issue as i forgot to subscribe to all notification on my repository. I'm taking a look about your issue.
Can you give me more info about your issue ?
When you say "When opening the page with GeckoView for the second time, throw the following exception.", what do you mean by this ?
I'm actually shipping an update as i have seen that the Xamarin.Forms component does not change URI when Source is changed. I didn't have seen any crash during my tests.
Thanks for reply!!
I mean when I navigate to the page with GeckoView component, go back and navigate again.
I could locate the line when it threw the exception and is GeckoRuntime _runtime = GeckoRuntime.Create(Context);
I think when it initialize the GeckoView component for the second time it fail.
I solve it creating a CustomGeckoViewRenderer and overriding CreateNewSession Method.
public override Tuple<GeckoSession, GeckoRuntime> CreateNewSession()
{
GeckoSession _session = new GeckoSession();
GeckoRuntime _runtime = GeckoRuntime.GetDefault(Context);
_session.Open(_runtime);
return Tuple.Create(_session, _runtime);
}
I don't know if it's the best option but it works like a charm
Greetings!
Well it's very strange, i would imagine that if you go back and go on GeckoView again, the component would be totally cleared as it has been disposed by you going back.
I'm wondering if something is happning about the current Android context ?
I will take a look maybe in few days, as i'm already working on other things during the week. Thanks for your feedback and your own workaround.
I will see if there is something that is staling somewhere in the component.
This or there is something wrong with the current GeckoView android build. I know that newer version have some additionnals dependency about app lifecycle and some other things, maybe there is some evolutions.
I don't have upgraded the GeckoView component because somehow signatures have changed in the new version, and i have a lot of difficulty to generate the same delegates class API from GeckoView with the new version.
Android java bindings for Xamarin are a pain ! :p
You were right about the GeckoRuntime.GetDefault(Context); call. I have search some doc and related comments on this thing (some are from 2 years ago). It seem that:
Also reading documentation, i have seen there is also an issue in the default OnNewSession method written in the NavigationDelegate i provide. The documentation state that the newly created session from this call must not be opened, and also the object must be referenced somewhere to not be garbage collected.
I have made modification, that i will ship very soon. Thanks for your feedback !
When opening the page with GeckoView for the second time, throw the following exception.
The first time when open the page it work perfectly, but when go back in navigation and get in again it fail.
MainActivity -> OnCreate
PortCostsPage.cs
Debug Console
Greetings!