"System.InvalidCastException: Specified cast is not valid." during Android RestoreInstanceState
See original GitHub issue🐛 Bug Report
Reproduction steps
- Start an Android app with MvvmCross.
- Use any app to fill all of the RAM.
- Return to the App with MvvmCross.
- Get a crash by calling MvxFragment`1.get_ViewModel()
System.InvalidCastException: Specified cast is not valid.
MvvmCross.Platforms.Android.Views.Fragments.MvxFragment`1.get_ViewModel()
An explicit cast to cause the exception
I’ve figured out the type of ViewModel via DataContext in non generic MvxFragment. DataContext’s type is MvxNullViewModel
Expected behavior
No crash. ViewModel’s type is TViewModel of generic MvxFragment<TViewModel>
Configuration
Version: 9.0.9
Platform:
- 🤖 Android
Issue Analytics
- State:
- Created 5 months ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
System.InvalidCastException: Specified cast is not valid. ...
I am on a C# ASP.NET project. I have a MySQL table with a userid field of type int . Now I want...
Read more >System.InvalidCastException : Specified cast is not valid
I connected a real Android phone to my Mac and recorded a test for it using Appium Studio. I took the code that...
Read more >System.InvalidCastException: Specified cast is not valid. ...
Hello. I use this design to upload images from the archive. But I ran into the problem, if there are more than 2...
Read more >MvvmCross/CHANGELOG.md at develop
InvalidCastException : Specified cast is not valid." during Android RestoreInstanceState #4600 ... Cancelable is 'false' when using empty ctor.
Read more >SQL SERVER - Restore Error: Specified cast is not valid ...
I have a backup from database in SQL Server 2008 R2. When I want to restore this backup to SQL Server, I get...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’ll see if I can get it done today or tomorrow
This was already released. Closing as I guess it is fixed in #4546.
Comment here if I need to reopen.