Closed Code-DJ closed 1 year ago
On Android seems working fine...
seems I'm not able to reproduce this issue, working fine on ios even after hot reloading it several times. Can you check your environment, this is mine: dotnet workload list
maui-ios 7.0.86/7.0.100 SDK 7.0.300
maui-android 7.0.86/7.0.100 SDK 7.0.300
Use dotnet workload search
to find additional workloads to install.
also can you downgrade mauireactor to 1.0.129 to see if it's still not working
Hi, I have the following workloads:
wasm-tools 7.0.8/7.0.100 SDK 7.0.300 ios 16.4.7067/7.0.100 SDK 7.0.300 maui 7.0.86/7.0.100 SDK 7.0.300
7.0.305
downgraded to 1.0.129 still see a crash in OrderingApp. It's like creating new objects for the data on the same page and binding it causes the System.InvalidCastException: Specified cast is not valid.
exception on Hot Reload.
The workaround for me has been to load the data on the previous page and send it as props.
Passing data as props doesn't crash the app but it blanks out the screen when you make changes. The props are lost by Hot Reload. If your previous screen is also a ListView, you have to go back further as that screen will also blank out by Hot Reload.
Well - I removed all the workloads and added only maui-ios, maui-android to match yours. Now it doesn't crash. The screen still clears and I have to back out to previous and come back in but at least it's not crashing.
Do you have any ideas on how to keep the state with Hot Reload? else we can close this issue. Thank you!
Hot-reload only keeps the component state in memory between iterations. Generally speaking, if you render props you need to copy the props to state.
Yes, I am copying the props to the state in OnMounted and OnPropsChanged - using SetState.
In testing, OnPropsChanged gets called on Hot Reload but the prop is null so may be that's causing it to clear. Will test.
UPDATE:
I'm going to close this issue because from what I can see now it's something not related to MauiReactor, feel free to continue commenting if you find anything I can help on
@adospace may be the crashes are related to this https://github.com/dotnet/maui/issues/11203 - fixed in .net 8.0-preview1
Not sure if this is an underlying MAUI problem, but ListView crashes on iOS after saving a couple of times with Hot Reload enabled.
Make a ProductItem change, save a couple of times. See it crash.
dotnet build -t:Run -f net7.0-ios /p:_DeviceName=:v2:udid=EECA5B10-A549-4D07-8A60-0CA944B62766
dotnet-maui-reactor -f net7.0-ios
Made the following changes to the OrderingApp: