Essentials icon indicating copy to clipboard operation
Essentials copied to clipboard

[Bug] Secure Storage on iOS 15 Returns Value in Debug build but No Value in Release build

Open ToddGlodek opened this issue 3 years ago • 2 comments

Description

on iOS Secure Storage does not return a value when release build selected, but does return a value when debug build is selected (Android appears to be fine). It is important to say that the app is already published in App Store and it was working fine on 14.x OS devices. In the current sprint/update it was working fine until we changed to iOS 15 ( using Xam.Forms 5.0.0.2244, Essentia.s v1.7, Xam.ComminityToolkit v1.3)

NOTE : this issue MIGHT be a duplicate of #1869 Using Secure Storage in App.cs causes crashing on iOS 14.6 and above

Steps to Reproduce

  1. In a project using Xamarin.Essentials.SecureStorage on iOS set the project to DEBUG mode.
  2. Using DEBUG mode verify that you can read write values to the secure storage repository
  3. Switch to RELEASE mode - execute the same code.

EXAMPLE

if (RememberCredentials)
{
    Username = await SecureStorage.GetAsync(Core.App.USER_NAME_KEY);
    Password = await SecureStorage.GetAsync(Core.App.USER_PASSWORD_KEY);

#if DEBUG Logger?.Trace("THIS IS DEBUG"); #else Logger?.Trace("THIS IS RELEASE"); #endif

    var stateDescr = Username == string.Empty ? "Is Empty" : "Has Value";
    Logger?.Trace( $"Username :  {  stateDescr  }");
}

Expected Behavior

The value returned by SecureStorage.GetAsync() should be the same between DEBUG/RELEASE

Actual Behavior

RUNNING AS DEBUG [Verbose] THIS IS DEBUG [Verbose] Username : Has Value

RUNNING AS RELEASE [Verbose] THIS IS RELEASE [Verbose] Username : Is Empty

Basic Information

  • Version with issue: Xam.Forms 5.0.0.2244, Essentials v1.7,
    Xam.ComminityToolkit v1.3 Build on iOS using SDK 15 - on multiple different build machines. NOTE : we first noticed this when upgrading the Xamarin Community Toolkit (XCT) to v 1.3. However because SecureStorage is in Essentials - upgrading the Community Toolkit shouldn't matter. It might also be concurrent with the upgrade to iOS: SDK 15.2.0.17

  • Last known good version: Xam.Forms 5.0.0.2196, Essentials v1.7,
    Xam.CommunityToolkit v1.2 iOS using SDK 15.2.0.17

  • IDE: Visual Studio 2019 Mac v 8.10.14

  • Platform Target Frameworks:

    • iOS: SDK 15.2.0.17 Target ios15
  • Android Support Library Version:

  • Nuget Packages: See above

  • Affected Devices:
    iOS 14x Physical Devices and 15 Simulators using SDK 15 to build

Reproduction Link

See code above..

ToddGlodek avatar Nov 18 '21 18:11 ToddGlodek

We have this too. We're migrating to MAUI, but that will take some time. Sad to see the silence on issues here.

psandgren avatar Sep 09 '22 09:09 psandgren

@psandgren - Would you please take a moment and post the versions of Xam.Forms, Essentials, Xam.ComminityToolkit, iOS Build SDK 15. That MIGHT help.. I have not tried to convert the project XAMARIN => MAUI because another critical subsystem was yet MAUI compatible.

I bet there is a new MAUI / ESSENTIALS repository that people are paying attention to. Perhaps I should open a copy of this bug there too ??

ToddGlodek avatar Sep 09 '22 18:09 ToddGlodek