Skip to content

Given_ApplicationDataContainer_When_GetAllKeys fails on iOS #1285

Closed

Description

@MartinZikmund

Current behavior

Given_ApplicationDataContainer_When_GetAllKeys fails on iOS when run on my device. The problem seems to be the fact, that even after clearing, the NSUserDefaults.StandardUserDefaults contains a ton of weird default settings like:

AppleLanguages, AppleLocale, NSInterfaceStyle, AppleITunesStoreItemKinds, AppleKeyboardsExpanded, PKKeychainVersionKey, ApplePasscodeKeyboards , AppleKeyboards, NSLanguages, NSInterfaceStyle

One of those being a date, which contains :, which Uno, unfortunately, uses as deserialization separator. This makes the DataTypeSerializer crash with exception.

Expected behavior

Runtime tests should run from SamplesApp without issues.

How to reproduce it (as minimally and precisely as possible)

Run Runtime tests via the SamplesApp on iOS.

Environment

Nuget Package:

Package Version(s):

Affected platform(s):

  • iOS
  • Android
  • WebAssembly
  • Windows
  • Build tasks

Visual Studio

  • 2017 (version: )
  • 2019 (version: 16.2 Preview 3)
  • for Mac (version: )

Relevant plugins

  • Resharper (version: )

Anything else we need to know?

Activity

  1. added
    kind/bug
    triage/untriaged
    platform/ios 🍎
    help wanted
    and removed
    triage/untriaged
    on Jul 22, 2019
  2. added
    hacktoberfest
    on Sep 25, 2019
  3. added and removed
    hacktoberfest
    on Jun 2, 2020
  4. added
    project/core-tools 🛠️
    and removed on Sep 21, 2020
  5. added
    difficulty/tbd
    on Feb 15, 2021
  6. xperiandri commented on Feb 17, 2021

    @xperiandri
    Contributor

    Critical bug. Having it you kan only save a fixed set of values keys for which you hardcode in code

  7. added this to the 3.6 milestone on Feb 18, 2021
  8. added
    difficulty/medium 🤔
    and removed
    difficulty/tbd
    on Feb 18, 2021
  9. 8 remaining items

  10. removed their assignment
    on Jan 6, 2022
  11. added
    area/tests 🧪
    on Dec 15, 2022
  12. changed the title [-]Given_ApplicationDataContainer_When_GetAllKeys fails on iOS[/-] [+]`Given_ApplicationDataContainer_When_GetAllKeys` fails on iOS[/+] on May 31, 2023
  13. MartinZikmund commented on Jun 17, 2024

    @MartinZikmund
    MemberAuthor
  14. added
    project/non-ui ⚙️
    on Jul 15, 2025
  15. MartinZikmund commented on Jul 15, 2025

    @MartinZikmund
    MemberAuthor

    Still relevant to both Skia and Native renderer

  16. MartinZikmund commented on Apr 7, 2026

    @MartinZikmund
    MemberAuthor

    Repro generator

    Runtime test(s) added in branch dev/mazi/repro/1285:

    • src/Uno.UI.RuntimeTests/Tests/Windows_Storage/Given_ApplicationDataContainer.cs → When_GetEnumerator_Returns_Correct_Values_Not_Keys
    • src/Uno.UI.RuntimeTests/Tests/Windows_Storage/Given_ApplicationDataContainer.cs → When_Values_Collection_Returns_Stored_Value

    When_GetEnumerator_Returns_Correct_Values_Not_Keys fails on Skia Desktop (and likely on all platforms): iterating via foreach over Values returns the raw serialized string System.String:hello_world instead of the deserialized value hello_world.

    Root cause found in two places:

    • src/Uno.UWP/Storage/ApplicationDataContainer.skia.cs:181 — GetEnumerator() returns v.Value (raw serialized string) without calling DataTypeSerializer.Deserialize(v.Value)
    • src/Uno.UWP/Storage/ApplicationDataContainer.Apple.cs:104 — GetEnumerator() passes k.Key.ToString() instead of k.Value?.ToString() to DataTypeSerializer.Deserialize

    The Values property on both platforms correctly calls DataTypeSerializer.Deserialize, but GetEnumerator() does not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/tests 🧪difficulty/medium 🤔has-repro-branchhelp wantedkind/bugplatform/ios 🍎project/core-tools 🛠️project/non-ui ⚙️

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions