-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
When using the [PersistentState] attribute on an iPhone, we are seeing unexpected behaviour when the app is backgrounded and disconnects (after 3 minutes)
Expected Behavior
The app should reconnect and restore state including the last typed value.
Steps To Reproduce
- Scaffold a new .NET 10 project with Blazor Web App and the following settings:
- .NET 10 Preview
- Auth: none
- Interactive render mode: server
- Interactivity: global
- include sample pages: true
- On the counter page add the code below
`
@page "/counter"
Counter
<h1>Counter</h1>
<EditForm Model=@CarViewModel>
<label>Make</label>
<InputText @bind-Value="CarViewModel.Make" />
<label>Model</label>
<InputText @bind-Value="CarViewModel.Model" />
<input type="submit" value="Submit" class="btn btn-primary" />
</EditForm>
@code {
[PersistentState]
public CarViewModel CarViewModel { get; set; }
protected override async Task OnInitializedAsync()
{
if(CarViewModel is null)
{
CarViewModel = new CarViewModel();
}
}
}
`
- Add a viewmodel:
public class CarViewModel { public string Make { get; set; } public string Model { get; set; } }
- Deploy to IIS and go to an iPhone/iPad
- Type into each field and leave the browser but don't lose focus from the last field.
- After 3 minutes go back in to Safari. The first field will be populated but the second field will be lost.
If you repeat this for less than the 3 minutes then it manages to keep the last field. Its only when the connection is fully lost that its losing the data (ie when the [PersistentState] attribute is doing the work).
Exceptions (if any)
No response
.NET Version
10.0.100-rc.1.25451.107
Anything else?
VS: 17.14.12 Preview 1.0
.NET SDK:
Version: 10.0.100-rc.1.25451.107
Commit: 2db1f5ee2b
Workload version: 10.0.100-manifests.a6e8bec0
MSBuild version: 17.15.0-preview-25451-107+2db1f5ee2
Runtime Environment:
OS Name: Windows
OS Version: 10.0.26100
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\10.0.100-rc.1.25451.107\
.NET workloads installed:
[maui-windows]
Installation Source: VS 18.0.11104.47, VS 17.14.36408.4
Manifest Version: 10.0.0-rc.1.25452.6/10.0.100-rc.1
Manifest Path: C:\Program Files\dotnet\sdk-manifests\10.0.100-rc.1\microsoft.net.sdk.maui\10.0.0-rc.1.25452.6\WorkloadManifest.json
Install Type: Msi
[maccatalyst]
Installation Source: VS 18.0.11104.47, VS 17.14.36408.4
Manifest Version: 18.5.10727-net10-rc.1/10.0.100-rc.1
Manifest Path: C:\Program Files\dotnet\sdk-manifests\10.0.100-rc.1\microsoft.net.sdk.maccatalyst\18.5.10727-net10-rc.1\WorkloadManifest.json
Install Type: Msi
[ios]
Installation Source: VS 18.0.11104.47, VS 17.14.36408.4
Manifest Version: 18.5.10727-net10-rc.1/10.0.100-rc.1
Manifest Path: C:\Program Files\dotnet\sdk-manifests\10.0.100-rc.1\microsoft.net.sdk.ios\18.5.10727-net10-rc.1\WorkloadManifest.json
Install Type: Msi
[android]
Installation Source: VS 18.0.11104.47, VS 17.14.36408.4
Manifest Version: 36.0.0-rc.1.285/10.0.100-rc.1
Manifest Path: C:\Program Files\dotnet\sdk-manifests\10.0.100-rc.1\microsoft.net.sdk.android\36.0.0-rc.1.285\WorkloadManifest.json
Install Type: Msi
Configured to use workload sets when installing new manifests.
No workload sets are installed. Run "dotnet workload restore" to install a workload set.
Host:
Version: 10.0.0-rc.1.25451.107
Architecture: x64
Commit: 2db1f5ee2b
.NET SDKs installed:
3.1.426 [C:\Program Files\dotnet\sdk]
6.0.428 [C:\Program Files\dotnet\sdk]
9.0.304 [C:\Program Files\dotnet\sdk]
10.0.100-preview.7.25380.108 [C:\Program Files\dotnet\sdk]
10.0.100-rc.1.25451.107 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.19 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 10.0.0-preview.7.25380.108 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 10.0.0-rc.1.25451.107 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.19 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 10.0.0-preview.7.25380.108 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 10.0.0-rc.1.25451.107 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.19 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 10.0.0-preview.7.25380.108 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 10.0.0-rc.1.25451.107 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables:
Not set
global.json file:
Not found