[UWP][VB]Enumerations Not Serializable For ApplicationData.Current.LocalSettings.Values RRS feed

  • Question

  • I have the following enumeration and code that attempts to save it to the app data:

    Public Enum GameStage
    End Enum
    ApplicationData.Current.LocalSettings.Values("GameStage") = GameStage.Bidding

    As you can see, this is very simple code, but when I run it, I get the following message:

    System.Exception: 'Data of this type is not supported.

    Error trying to serialize the value to be written to the application data store'

    The default underlying data type for enumerations is Integer, so why can't I save/serialize this value? I would think that this would be one of the simplest things to serialize. I'm sure there is some easy way to do this, but manually converting the value to & from an Integer every time I do this seems like a lot of extra work. What should I do? Thanks.

    Nathan Sokalski

    Thursday, July 11, 2019 11:41 PM

All replies

  • Hi,

    Only the date types in this document:Windows Runtime base data types could be stored into localsetting.

    >>The default underlying data type for enumerations is Integer

    It does not make sense. There are still enumerations. 

    >> What should I do? 

    To solve this, a common way is to convert your enumeration class to a string.

      var setting = ApplicationData.Current.LocalSettings;
                setting.Values["GameStage"] = GameStage.Bidding.ToString();
                var value = setting.Values["GameStage"];

    Best regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Friday, July 12, 2019 2:16 AM