Skip to content

Preferences are cleared in debug mode android it works fine in release mode #28654

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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
taddisateesh opened this issue Mar 27, 2025 · 6 comments
Labels
area-essentials Essentials: Device, Display, Connectivity, Secure Storage, Sensors, App Info t/bug Something isn't working
Milestone

Comments

@taddisateesh
Copy link

Description

public string LanguageCode
{
get => Preferences.Default.Get(nameof(LanguageCode), string.Empty);
set => Preferences.Default.Set(nameof(LanguageCode), value);
}

in the above code Preferences getting cleared on next launch.
FYI: This can be reproducable in debug mode. Release mode it works fine.

Steps to Reproduce

No response

Link to public reproduction project repository

No response

Version with bug

9.0.40 SR4

Is this a regression from previous behavior?

No, this is something new

Last version that worked well

8.0.71 SR7.1

Affected platforms

Android

Affected platform versions

Android

Did you find any workaround?

No response

Relevant log output

@taddisateesh taddisateesh added the t/bug Something isn't working label Mar 27, 2025
@sheiksyedm
Copy link
Contributor

@taddisateesh I checked this issue in a simple way using the default .NET MAUI template, and it works fine in both debug and release modes. Can you share a reproduction sample to replicate the issue?

@sheiksyedm sheiksyedm added the s/needs-repro Attach a solution or code which reproduces the issue label Mar 27, 2025
@dotnet-policy-service dotnet-policy-service bot added s/needs-attention Issue has more information and needs another look and removed s/needs-repro Attach a solution or code which reproduces the issue labels Mar 27, 2025
@sheiksyedm sheiksyedm added s/needs-repro Attach a solution or code which reproduces the issue and removed s/needs-attention Issue has more information and needs another look labels Mar 27, 2025
@taddisateesh
Copy link
Author

taddisateesh commented Mar 27, 2025

@sheiksyedm I have attached sample project here. Please test this on android device/emulator in debug mode

PreferencesSample 2.zip

@dotnet-policy-service dotnet-policy-service bot added s/needs-attention Issue has more information and needs another look and removed s/needs-repro Attach a solution or code which reproduces the issue labels Mar 27, 2025
@taddisateesh
Copy link
Author

PreferencesSample 2.zip

@jfversluis jfversluis added the area-essentials Essentials: Device, Display, Connectivity, Secure Storage, Sensors, App Info label Mar 27, 2025
@sheiksyedm
Copy link
Contributor

@taddisateesh Can you share the device info along with the Android version? I tested this issue on a Google Pixel 6a (Android 14, API 34), and it was not reproducible in the latest 9.0.50 SR5.

@sheiksyedm sheiksyedm added the s/needs-info Issue needs more info from the author label Mar 27, 2025
@dotnet-policy-service dotnet-policy-service bot removed the s/needs-info Issue needs more info from the author label Mar 27, 2025
@sheiksyedm sheiksyedm added the s/needs-info Issue needs more info from the author label Mar 28, 2025
@taddisateesh
Copy link
Author

@sheiksyedm Could you please verify using vs code for mac ?

@dotnet-policy-service dotnet-policy-service bot removed the s/needs-info Issue needs more info from the author label Mar 28, 2025
@sheiksyedm
Copy link
Contributor

@taddisateesh yes, I verified this using VS Code for mac only(Emulator Pixel 7, API 35). Please check the video for your reference.

Screen.Recording.2025-03-28.at.7.59.00.PM.mov

@rmarinho rmarinho added this to the Backlog milestone Apr 9, 2025
@rmarinho rmarinho removed the s/needs-attention Issue has more information and needs another look label Apr 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-essentials Essentials: Device, Display, Connectivity, Secure Storage, Sensors, App Info t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants