-
Notifications
You must be signed in to change notification settings - Fork 55
[Bug] Strange behavior when app loses focus application refresh and starts at index page. #191
Comments
There is actually two cases when this behavior may happen:
Note: I don't have your behavior, tested on the template code and also on a business app shipped to one of my client. So you may be in one of theses issue. Check your code first, and if you still have the issue, tell what is the OS version, targeted API and CPU architecture. Then only, send a repro project if you think it's a bug. |
I really have no idea what could be wrong. I will attach a project which reproduces this behavior. I also still receiving the socket communication error #182 but don't know why this is happening at all which also reproduces in this project. I tried uploading here the solution but is more than then 10MB allowed here. I am uploading to mediafire I will post the sample project when upload is completed. |
Don't forget to delete all your obj and bin folders before upload here as they are taking a lot of disk space, but generated at compile time. You may also create a repository on Github that i can fork then. |
Do you have this issue while deploying the base template ? |
I will test base template and reply back |
It doesn't happens on base template. But don't know why does this happens at all. I added a test project to see if you can tell what is wrong with sockets connection and this random error on android. Project size is only 14MB. |
Thanks ! I reproduced your bug on your project.
Notice the last message. It seem that for whatever reason, your app fail to connect to the native side when startup, and therefore your app is never able to say to native that it loaded properly at boot, that's why when resuming, it reload ! I'm investigating why your app don't work out of the box. |
Thanks for reporting your issue. After investigations, it seem that there is two bugs.
Workaround before i fix this correctly: Call BlazorMobileService.EnableClientToDeviceRemoteDebugging("127.0.0.1", 8888); In your Program.cs file of your Blazor WASM project. You should keep 127.0.0.1 for workarounding the current issue when the app load from native. Of course change the value to anything else if you needed to remote / test debug the WASM app too to device (but normally you don't, you usually use Blazor.Server configuration instead !). Otherwise the port must be the same as your remote app (by default 8888 should be fine).
I don't have a direct workaround before i fix this without you modify your project a little (i think). Then from the Success delegate, just change the boolean condition and ask to re-render your index page. The real fix in my opinion, in order to avoid tricky change would be that the plugin use his own "boot page" and then redirect anything to the regular page of your app when ready. But this is an evolution i must do too. |
If you set the right info for remote debugging everything is fine (i just tested). |
Let me read stuff u write 2 fast hahahahaha |
I was writing while you answered ! |
Sorry for my misunderstanding. I didn't understand what were the changes you made to workaround this. I even commented my index.razor page and I still receive the same error. Can you tell me exactly what you did or send me the fix back here? Screenshots maybe be enough and fast for this. |
Here is your workarounded project: I moved BlazorMobileService.Init call into your Index.razor page, and managed to delay the render of your components after BlazorMobile initialization. Of course this is a workaround, you should be able in the future to do this without doing any kind of trickery code at start. See updated code in Index.razor . Otherwise, you will notice that i called the remote debugging method to 127.0.0.1:8888 in Program.cs . You should not have to call that normally, as it's for redirecting where to connect, but same, because of the actual regression it's a workaround. You should be able to not have any issue in the future soon even without this line. I just tested by debugging the GeckoView component remotely with WebIDE (not available anymore but still present in Firefox 67 with SHIFT+F8) and everything work fine now. Will update this issue when this is resolved officially in the BlazorMobile library ! |
Ok I will try |
Just to keep you updated, i done some updates for the next version.
I will keep you updated when a new version will be released ! |
Closing, as it will be available in next version. |
@Daddoon my project has a lot of dependencies its a good project for testing your updates in my opinion. Thanks for keeping me in the loop. |
I already tested with the test project you send me so it should be ok ! Internally the new way is like "Load Blazor....Render BlazorMobile and wait for Init...Then render anything from the user app", so i think even if you put a lot of thing it should be ok, as your app logic will be loaded after the BlazorMobile component. If you want to take a look, you may try to fork the current BlazorMobile 3.2.5 branch, and try to compile source, and retrieve nuget packages, even if this build is not final, as i'm investigating some other points not related to this issue. The migration guide has been also updated already on this branch, so you should be able to see how to migrate. |
A new version has been released ! See migration here: https://github.com/Daddoon/BlazorMobile/blob/master/MIGRATION.md#blazormobile-324-preview2201605-to-325-preview3201683 |
@Daddoon I have been very busy I will test and give feedback! |
This test have been run on Android.
I have been facing a strange behavior on web app when ever I open an external link that use the browser, move from the application window to another and return back or exactly when I pull a file from the device the app refreshes and goes back to the index page? It even happens when I block and unblock my phone. Why the applications does this when the application window loses focus?
The text was updated successfully, but these errors were encountered: