Cant get storage data - segmentation faul (xamarin)


I am really confuse, I need save some data from users, and I use this:

my code:

using Xamarin.Essentials;
namespace Pulsometer
public partial class SettingsPageBpmRange : CirclePage

 public SettingsPageBpmRange()

    private void setMyData()
        **var minbrm = Preferences.Get("min_brm", "0");** // this gave me segmentation faul when testing on emulator.. no errors in visual studio
        //showStorage.Text = minbrm;

    void OnSliderValueChanged1(object sender, ValueChangedEventArgs args)
        var value = (int)args.NewValue;
        minimumRange.Text = String.Format("Min BPM: {0}", value);
        **Preferences.Set("min_brm", value);**

Can someone help me, what I´am doing wrong…? Oe how can I easily set and get data ?

You are saving an integer value but getting it as a string? I think the behavior is undefined and may results in an error in that case.

you are right! Thank you. Sorry for this noob question, I´m quite newbie in C# :slight_smile:

var test = String.Format("{0}", value);
Preferences.Set(“my_min”, test);

this work.