Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Application gets stuck on splash screen in Release config with MvvmCross 8.0.2 #4364

Open
3 of 9 tasks
entdark opened this issue Feb 9, 2022 · 17 comments
Open
3 of 9 tasks
Labels
s/needs-more-info Needs more information from the reporter

Comments

@entdark
Copy link
Contributor

entdark commented Feb 9, 2022

馃悰 Bug Report

Application gets stuck on splash screen.

Expected behavior

Application gets navigated to the first view model.

Reproduction steps

Compile an iOS app with Release | iPhone configuration:
SDK Version: 15.0
Linker behavior: Link Framework SDKs Only
Supported architectures: ARMv7 + ARM64
HttpClient: Managed
Debug information: None

  • Strip native debugging symbols
  • Enable optimizations

Either publish for TestFlight or locally launch on an iPhone device.
The steps may not work on other projects.

Configuration

Version: 8.0.2

Platform:

  • 馃摫 iOS
  • 馃 Android
  • 馃弫 WPF
  • 馃寧 UWP
  • 馃崕 MacOS
  • 馃摵 tvOS
  • 馃悞 Xamarin.Forms

Comment

That started after upgrading from 6.4.2 to 8.0.2.
I also cannot debug it since with any debugging option enabled (still in Release configuration) the issue disappears.
When I tried to downgrade to 7.1.2 the issue has gone as well.

I tried to find out the cause of the issue myself and found out that NavigateToFirstViewModel never finishes if awaited.
If await is removed then the app crashes.
I could be wrong it's the key of the issue, just the maximum I could find myself.

@EGoverde
Copy link

I'm also having this issue. I tried finding the issue and removing most packages, in the end it was mostly just MvvmCross that was left. The linker is set to SDK only. but the only build setting that seems to cause the hanging is debugging set to false (MtouchDebug). Reverting back to 7.1.2 did fix the issue.

@Cheesebaron
Copy link
Member

Cheesebaron commented Feb 22, 2022

Is this something reproducible for you in the Playground.iOS project too?

Edit: Nevermind, just noticed that you are writing Release mode. I can reproduce this as well in TipCalc sample. Digging into the issue.

@Cheesebaron
Copy link
Member

OK, turned out TipCalc.iOS sample was missing a LinkerPleaseInclude file to hint usage of stuff.

To be able to better debug this at your end. You can take a look at the device log with the Console app on your mac with the device attached. Here you should be able to see any exceptions thrown. I need more info to go from to be able to debug your issue.

@Cheesebaron Cheesebaron added the s/needs-more-info Needs more information from the reporter label Feb 22, 2022
@entdark entdark changed the title Application gets stuck on splash screen with MvvmCross 8.0.2 Application gets stuck on splash screen in Release config with MvvmCross 8.0.2 Feb 24, 2022
@entdark
Copy link
Contributor Author

entdark commented Mar 14, 2022

mvvmcross8.0.2_freeze_log.txt
If it's any helpful.

@Cheesebaron
Copy link
Member

@entdark I guess your App is Ska?

It looks like it is running and doing a bunch of network and location calls. No exceptions thrown. You are probably in some kind of dead lock blocking the UI thread so it cannot continue.

@entdark
Copy link
Contributor Author

entdark commented Mar 28, 2022

@entdark I guess your App is Ska?

Yes. It is.
So why does it work fine in 7.1.2 if basically nothing got changed? And it works in Debug.

@tvone-timmoore
Copy link

With Mvx 8.0.2, WPF, .NET 5.

I'm having a similar problem when trying to publish a message from code called from MvxAppStart.NavigateToFirstViewModel() and the MvxMessenger is getting stuck waiting for the UI Thread.

I'm processing the command line args to load a file and navigate to the correct viewmodel, the same code works when selecting a load button after the UI shows.

This previously worked with Mvx 7 and lower.

@tvone-timmoore
Copy link

I've not managed to find out what the difference is between 7 and 8, as the way things get started has changed (sidenote: not a fan of having to use MvxWindow looking for ways to remove that dependency!), but I have found some more info about what is happening.

When I load the file I process parts of it with multiple Task.Run() which speeds loading up a great deal, there is a lot of data to process.

When I do that the context is no longer the main thread and MvxMessenger.Publish() tries to dispatch back to the main thread.

I've verified this by checking Mvx.Resolve<MvvmCross.Base.IMvxMainThreadDispatcher>().IsOnMainThread at various breakpoints.

If I remove all the Task.Run()s then the application runs, but processing the file is very slow, and I do not get any process updates.

The question is why is MvxMessenger deadlocking from an awaited load method from the MvxAppStart.NavigateToFirstViewModel() but not from other locations like an async command aka button click which is also on the main thread?

For now, I'm going to try using an interim "loading" viewmodel to load the data and navigate to the landing viewmodel and see if that works.

@entdark
Copy link
Contributor Author

entdark commented Apr 6, 2022

I think you (and/or me) could try to add MvvmCross 8.0.2 projects to your own project and see step by step what's going on.

@tvone-timmoore
Copy link

I've created a loader viewmodel and moved the load and navigate code to an async method that is invoked from Start() ........and........it works!!!! no deadlocks from MvxMessager even when awaiting the Navigate() from NavigateToFirstViewModel().

@tvone-timmoore
Copy link

I think you (and/or me) could try to add MvvmCross 8.0.2 projects to your own project and see step by step what's going on.

If I pause the app and go to the blocked task and up the call stack it's sitting on "return true" in MvxWpfUIThreadDispatcher.RequestMainThreadAction().

image

@entdark
Copy link
Contributor Author

entdark commented Apr 11, 2022

@Cheesebaron Another issue on iOS in Release. Now it crashes. Try it out yourself: https://github.com/entdark/JKChat/tree/mvvmcross_8.0.2
Works fine with 7.1.2.

@ntdung
Copy link

ntdung commented Apr 25, 2022

@entdark I'm pretty sure it will work if you down grade Microsoft.Extensions.Logging nuget package from 6.0.0 to 5.0.0.

@entdark
Copy link
Contributor Author

entdark commented Apr 25, 2022

@entdark I'm pretty sure it will work if you down grade Microsoft.Extensions.Logging nuget package from 6.0.0 to 5.0.0.

Why?

@entdark
Copy link
Contributor Author

entdark commented Apr 26, 2022

Downgrading Microsoft.Extensions.Logging to 5.0.0 didn't help.

@ivmirx
Copy link
Contributor

ivmirx commented May 2, 2022

Probably can be temporarily solved with this workaround.

@entdark
Copy link
Contributor Author

entdark commented May 4, 2022

@ivmirx The workaround fixed the issue in both freezing and crashing projects.
Thank you very much!
@Cheesebaron take at look at the workaround please.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s/needs-more-info Needs more information from the reporter
Development

No branches or pull requests

6 participants