-
Notifications
You must be signed in to change notification settings - Fork 730
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
ApplicationData.Current.LocationSettings bug #1276
Comments
Howdy @NGame1, can you please provide a project that reproduces this? ie. |
Does the same code run under UWP without exception? |
@MartinZikmund yes it does. In UWP if it can't find a key it will return null. |
I will try to reproduce in unit tests |
@NGame1 Can you verify this has been fixed in latest preview build :-) ? |
@MartinZikmund In reality no. My current project can not run on build 2311. |
@NGame1 can you open another issue that shares with us what's preventing you from using build 2311? Thanks. |
Current behavior
My sample code that doesn't work
It fails with the following error
"Operation is not valid due to the current state of the object."
Trace:
" at Windows.Storage.ApplicationDataContainer+SharedPreferencesPropertySet.get_Item (System.String k…"
It has a workaround, fortunately.
Change the below line:
public static AppInternalSettingsCore AppInternalSettings => AppSettings.Values["AppInternalSettings"] == null ? new AppInternalSettingsCore() : JsonConvert.DeserializeObject<AppInternalSettingsCore>(AppSettings.Values["AppInternalSettings"].ToString());
with this one:
public static AppInternalSettingsCore AppInternalSettings => AppSettings.Values.ContainsKey("AppInternalSettings") == false ? new AppInternalSettingsCore() : JsonConvert.DeserializeObject<AppInternalSettingsCore>(AppSettings.Values["AppInternalSettings"].ToString());
Nuget Package:
Package Version(s):V1.46.0-dev2264
Affected platform(s):
Visual Studio
Relevant plugins
The text was updated successfully, but these errors were encountered: