question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error while using SecureStorage in MAUI application

See original GitHub issue

Description

Application crashes with the below error when using SecureStorage: System.IO.FileNotFoundException: ‘Could not load file or assembly ‘Xamarin.AndroidX.Security.SecurityCrypto, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’ or one of its dependencies.’

Steps to Reproduce

  1. Create a new project using template “.NET MAUI App (Preview)”
  2. Open MainPage.xaml.cs and add the following line to OnCounterClicked mehtod: string testValue = await SecureStorage.GetAsync(“Test”);
  3. Run application > Click on the “Click me” button. The application crashes with the exception: System.IO.FileNotFoundException: ‘Could not load file or assembly ‘Xamarin.AndroidX.Security.SecurityCrypto, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’ or one of its dependencies.’

Version with bug

Preview 11

Last version that worked well

Unknown/Other

Affected platforms

Android, I was not able test on other platforms

Affected platform versions

Android 11

Did you find any workaround?

Add Xamarin.AndroidX.Security.SecurityCrypto (Version: 1.1.0-alpha03) NuGet package to project

Relevant log output

Resolved pending breakpoint at 'MainPage.xaml.cs:19,1' to void MauiTestApp.MainPage.<OnCounterClicked>d__2.MoveNext () [0x000e7].
[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.Security.SecurityCrypto.dll
**System.IO.FileNotFoundException:** 'Could not load file or assembly 'Xamarin.AndroidX.Security.SecurityCrypto, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.'

[monodroid-assembly] open_from_bundles: failed to load assembly Xamarin.AndroidX.Security.SecurityCrypto.dll

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:7
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
carlosmunozrodriguezcommented, Jan 7, 2022

@carlosmunozrodriguez, It worked with the workaround method by @UwpDev for Android. How did you fix it for iOS?

I haven’t tested in iOS yet. I can live without the workaround for the moment until this bug is fixed

0reactions
RaspeR87commented, Feb 3, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

Suddenly getting SecureStorage issues in MAUI
I use SecureStorage for storing API logins, and tokens. Have been using them for ages, but this has come up all of a...
Read more >
SecureStorage not working in MAUI with android emulator
I'm new to MAUI and i want to save a token to the secureStorage. I have the following line to save the key...
Read more >
SecureStorage deadlock when called from an DI class.
This code, when called from a maui project razor page with ICustomStorage dependency injected, causes deadlock/application hang.
Read more >
How to use .Net MAUI Secure storage in your Mobile ...
The following steps are to create/get / Clear secure storage using.Net MAUI application. The .Net MAUI Secure Storage and ISecureStorage types ...
Read more >
Add Authentication to .NET MAUI Apps with Auth0
Learn how to authenticate users of your .NET MAUI application using Auth0. Read more… :writing_hand:t2: Brought to you by @andrea.chiarelli.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found