SecureStorage returns null for all values after restarting app (Android) #23013
Labels
area-essentials
Essentials: Device, Display, Connectivity, Secure Storage, Sensors, App Info
delighter
migration-compatibility
Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert
platform/android 🤖
s/triaged
Issue has been reviewed
s/verified
Verified / Reproducible Issue ready for Engineering Triage
t/bug
Something isn't working
Milestone
Description
If I set a value in the SecureStorage
await SecureStorage.SetAsync("TestKey", "TestValue")
during the first app startup, and then return the valueawait SecureStorage.GetAsync("TestKey")
, the value is returned correctly. But if I close the app, even from running in the background, and restart it a second time, and callawait SecureStorage.GetAsync("TestKey")
, then it returns null. But if I set the value again, then it starts working successfully, and returns the value corectly if I restart the app a third time and so on.Steps to Reproduce
Task.Run(async () => { await SecureStorage.SetAsync("TestKey", "TeskKey"); var val = await SecureStorage.GetAsync("TeskKey"); });
and add a breakpoint in the last line of code.
await SecureStorage.SetAsync("TestKey", "TeskKey");
.Link to public reproduction project repository
No response
Version with bug
8.0.40 SR5
Is this a regression from previous behavior?
Yes, this used to work in Xamarin.Forms
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
Android 12 and below
Did you find any workaround?
No
Relevant log output
The text was updated successfully, but these errors were encountered: