Skip to content
This repository was archived by the owner on May 15, 2024. It is now read-only.
This repository was archived by the owner on May 15, 2024. It is now read-only.

iOS: Error adding record: DuplicateItem thrown when setting secure value #704

@kensykora

Description

@kensykora

Description

One time, I experienced an exception being thrown when trying to set a secure value. This value was an updated refresh/oauth token which only gets updated occasionally, and it happened on an iOS simulator when I deployed an updated version of the app to the simulator after it sat idle overnight. Additionally I had done a full git clean git clean -xdf and rebuild after switching branches.

I'm unclear if this is a normal use case that I need to handle or if it is just a "Development Artifact" that I can safely ignore for production... right now I'm leaning toward it might be a rare scenario I need to handle... possibly during app updates?

Steps to Reproduce

I don't have reliable steps to reproduce unfortunately, nor a minimum reproduction sample. If it happens again I'll try to make one. The rough steps are

  1. Set something into secure storage in an app on an iOS simulator
  2. Clean the app in git, full clean -- git clean -xdf
  3. Deploy an updated version of the app

Expected Behavior

Secure storage continues to work

Actual Behavior

Exception is thrown:

System.Exception: Error adding record: DuplicateItem
  at Xamarin.Essentials.KeyChain.SetValueForKey (System.String value, System.String key, System.String service) [0x00071] in <80b8ae4e16374c93b74637a8a9a92836>:0 
  at Xamarin.Essentials.SecureStorage.SetAsync (System.String key, System.String value, Security.SecAccessible accessible) [0x00027] in <80b8ae4e16374c93b74637a8a9a92836>:0 
  at Xamarin.Essentials.SecureStorage.PlatformSetAsync (System.String key, System.String data) [0x00007] in <80b8ae4e16374c93b74637a8a9a92836>:0 
  at Xamarin.Essentials.SecureStorage.SetAsync (System.String key, System.String value) [0x00021] in <80b8ae4e16374c93b74637a8a9a92836>:0 
  at App.MyApp.Services.LocalStorageServiceBase.set_IdToken (System.String value) [0x0001a] in /Users/kensykora/Workspace/App.myapp/src/App.MyApp/Services/LocalStorageServiceBase.cs:178 
  at App.MyApp.Services.Login.LoginService+<RefreshCurrentLogin>d__16.MoveNext () [0x0020d] in /Users/kensykora/Workspace/App.myapp/src/App.MyApp/Services/Login/LoginService.cs:123

Basic Information

  • Version with issue: 1.0.0
  • Last known good version: n/a
  • IDE: VS for Mac
  • Platform Target Frameworks:
    • iOS: 12.1
  • Nuget Packages: 1.0.0
  • Affected Devices:

Screenshots

n/a

Reproduction Link

LMK if you need one, I can try and spend some time and find more detail here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions