Closed Kukkimonsuta closed 5 years ago
+1 to this. Seems like an issue with Xamarin.iOS SDK version 12.6 (preview). Downgrading Xamarin.iOS to version 12.2 seems to work.
I got this same error today using VS 2019 Preview v4.1. I will try downgrading the iOS sdk to 12.2.
Thanks!
Same issue here with VS 2019 Preview 4.1 SVC1 and Xamarin.iOS 12.6.0.23. Is there any workaround besides downgrading?
I am able to reproduce this on the official VS 2019 release that came out earlier today (version 8.0 build 3001) with Xamarin iOS 12.6.0.25, I am using the latest Xamarin.Auth version which is 1.6.0.4.
Exception log:
System.AggregateException: One or more errors occurred. (Search/Find FindAccountsForServiceAsync Object reference not set to an instance of an object) ---> Xamarin.Auth.AccountStoreException: Search/Find FindAccountsForServiceAsync Object reference not set to an instance of an object ---> System.NullReferenceException: Object reference not set to an instance of an object at Xamarin.Auth.KeyChainAccountStore+<>c.<.cctor>b__12_2 () [0x00042] in <85539ee049364f3e8d64880a4a42b589>:0 at System.Lazy
1[T].ViaFactory (System.Threading.LazyThreadSafetyMode mode) [0x0001c] in
at System.LazyHelper.ThrowException () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.6.0.25/src/Xamarin.iOS/external/corefx/src/Common/src/CoreLib/System/Lazy.cs:97
at System.Lazy1[T].CreateValue () [0x0007e] in <f6fd5b6dc94346cb9547cf7dbf9aa8b2>:0 at System.Lazy
1[T].get_Value () [0x0000a] in
having the same issue with the latest visual studio 2019 release
I started getting the issue after Visual Studio 2019 Update. Xcode and Xamarin are all up to date.
+1 having the same issue since this morning. In the meantime, any help where I can find the installer to downgrade Xamarin.iOS to version 12.2?
I have same issue this morning. One solution is to downgrade vs to 2017, I think you can't downgrade only Xamarin.iOS, if someone success, please share solution. Another solution is to use SecureStorage from Xamarin.Essentials instead Xamarin.Auth account store.
Folks, we'll take a look at this one, but the correct way forward is to switch to SecureStorage from Xamarin.Essentials as we have deprecated the AccountStore in Xamarin.Auth.
Also here's a migration guide to switch to SecureStorage in Xamarin.Essentials: https://github.com/xamarin/Xamarin.Auth/wiki/Migrating-from-AccountStore-to-Xamarin.Essentials-SecureStorage
@Kukkimonsuta Did you manage to fix that line? If yes, could you share your repo?
@someone1984 don't need to downgrade the VS2019, just downgrade the Xamarin.IOS version to 12.2.1.16, here is the link https://dl.xamarin.com/MonoTouch/Mac/xamarin.ios-12.2.1.16.pkg
@wayousuf thanks for your suggestion, I tried it right now and it's working. But anyway maybe in future, best solution is replace Xamarin.Auth AccountStore with SecureStorage.
Hi @Redth
I'm migrating to secure storage, in Android, I'm already overriding OnRequestPermissionsResult for certain activities using custom request codes. Does this matter when setting Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults);
Apologies if this is not the right spot to ask this but thought it was good for anyone that wants to migrate too instead of downgrading.
Folks, we'll take a look at this one, but the correct way forward is to switch to SecureStorage from Xamarin.Essentials as we have deprecated the AccountStore in Xamarin.Auth.
@Redth Does SecureStorage use iOS keychain and Android Keystore? Why's there the need for migration? Also I don't think we can even migrate because this function is crashing
I have the same issue. When it will be fixed?
I moved to Xamarin Essentials. The only concern was that there are no Account class. You just create a dictionary of keys and strings. But you can always create your own handlers.
Hey folks, how do you migrate to SecureStorage if AccountStore.Create().FindAccountsForService(); throws exception? I am trying to migrate but with this crash is impossible...
@jcampana, I didn't migrate. I am actually not sure which scenario will require you to transfer the old keys to a new app. Usually, you ship a new clean app without any old info.
What i did is install the plugin and follow the api to store, retrieve, and delete the keys.
This code was fix/workaround for old bug in iOS. When will it be fixed?
I'm working on it. Currently trying to resurrect old projects so I can build the code.
Regarding AccountStore
OAuth does not specify anything about storing tokens. Storing access_token
is BAD security practice, so the vNext version of Xamarin.Auth will not have AccountStore for sure. Maybe in something like Xamarin.Auth.Extensions (or Extras) and it will use for sure Essentials.
Downgrading to Xamarin.iOS 12.2 worked for me as per @wayousuf’s suggestion but I agree, this is just a temporary fix.
Is it only AccountStore that is being deprecated or the whole Xamarin.Auth library? It seems SecureStorage uses Account class from Xamarin.Auth so that was confusing. From where to where are the accounts migrated?
@JPSiller SecureStorage does not use anything from Xamarin.Auth.
The design goal of Essentials was to have 0 or close to 0 dependencies. Account class is there, because Essentials drew few ideas from older libraries.
Xamarin.Auth was designed and implemented in 2012/2013. Reworked in 2016. It will be minimally maintained (bugfixin), but that is almost all.
Hi @moljac
Then does Xamarin.Essentials has it's own Account class?
From the migration guide https://github.com/xamarin/Xamarin.Auth/wiki/Migrating-from-AccountStore-to-Xamarin.Essentials-SecureStorage.
From the migration guide: "Now, instead, using the helper class you'd write:
await SecureStorageAccountStore.SaveAsync(account, "Facebook");"
That method uses the Xamarin.Auth account class
SecureStorageAccountStore
in the doc is wrapper for both Xamarin.Auth.Account
and Xamarin.Essentials.SecureStorage
.
Check the snippet in the doc.
Xamarin.Auth.AccountStore
from
is used only to migrate existing Xamarin.Auth accounts to new storage in Essentials.
Essentials use SetAsync(string, string)
, so the trick is to serialze Account to JSON.
@moljac Ok got it, thanks for the explanation so helper class is completely for migration.
After that you can use the SecureStorage directly. To migrate in iOS we will need to wait for the fix for this thread right?
After that, once all our users migrate to a version that utilizes secure storage we can safely remove Xamarin.Auth completely in the our next app release. Is that correct?
No problems at all. That's the reason we are here.
To migrate in iOS we will need to wait for the fix for this thread right?
I think so. But good new. I dusted Xamarin.Auth off, upgraded nugets and everything works. I was a bit afraid of this step. I'm testing right now, so patch/fix might be out soon
@moljac Awesome, thanks a lot.
@moljac So if the fix for Xamarin.Auth is out, do we still need to use Secure Storage with migration helper class, or we can do it later when we upgrade our solution to Xamarin.Essentials secure storage ?
I would also appreciate a quick hotfix for this issue as it currently blocks me from releasing an app update. Would love to migrate to SecureStorage but as previously mentioned, it won't work with the current version
+1 for now downgrading the Xamarin.IOS version to 12.2.1.16 worked
@tipa you can hotfix the issue by downgrading the IOS SDK from 12.6 to 12.2, as others wrote before. Just download and execute (install) this: https://dl.xamarin.com/MonoTouch/Mac/xamarin.ios-12.2.1.16.pkg (578 MB) (it's not necessary to downgrade anything else, like Visual Studio 2019, i tested this.)
@moljac thanks for working on a fix! even though Xamarin.Auth is deprecated and migrating to SecureStorage is the better long term fix, fixing Auth could give some QOL for existing projects.
@JPSiller You will want to keep Xamarin.Auth migration code until you can be sure that some majority of users is off of any of the versions that previously used AccountStore.
If a user skips the one version that has the AccountStore to Essentials migration code and instead updates to the version after that, the migration code would be gone and the app would no longer work for that user.
@hvaughan3 That's a good point, I think we'll have to leave it for a while until our analytics tell us 99% of our users are using a secure storage version as you suggested. Thanks.
Hope the fix is available soon
Do we have an ETA for a fix here? How can I downgrade the iOS from 12.6 to 12.2?
I installed the hotfix: https://dl.xamarin.com/MonoTouch/Mac/xamarin.ios-12.2.1.16.pkg
then I got an error about a System.Buffers Filenotfound exception
I'm using VS 2019 on PC (SSH to mac mini)
I downgraded the iOS version to 12.0 and 9.0 as well. Still facing the same issue. Any help would be really great.?
@rickyaare - so when will the new nuget package out? any ETA? thanks!
@softsan, I think we need someone from the team approving the pull-request and do the release.
I was facing the issue with FindAccountsForService
in an old project, and found the suggested fix after some debugging.
While we are waiting for a release of Xamarin.Auth you can build the cfboolean-truehandle branch yourself and reference this instead of the Xamarin.Auth NuGet package.
ping @moljac
@rickykaare - Thanks.
I have just taken easy way and gone back to VS 2017 and working fine
@moljac - Thanks a lot.
Dear community I beg you for a little bit patience, due to the fact that all artifacts (nugets) must be published via CI system (rules).
And of course due to our other tasks and obligations Xamarin.Auth code is a bit stale, so I need to fix Cake scripts and create Azure DevOps Pipelines. I will add support for VS2019 later on.
Thanks for understanding.
@someone1984 don't need to downgrade the VS2019, just downgrade the Xamarin.IOS version to 12.2.1.16, here is the link https://dl.xamarin.com/MonoTouch/Mac/xamarin.ios-12.2.1.16.pkg
@wayousuf's solution is the best, for those (like me) having in apps in production already, and cannot risk implementing last minute (great for the future) solution proposed by @Redth https://github.com/xamarin/Xamarin.Auth/issues/370#issuecomment-479491900
Please Xamarin team fix this issue on iOS SDK stable channel.
Hi! Lewix
@lewixlabs Hi! The solution has already been implemented, this is not a Xamarin.iOS issue but rather the Xamarin.Auth library needed to be upgraded to be compatible with the latest Xamarin.iOS.
Right now, the only thing left to do is for the Xamarin.Auth nuget package to be released so you can easily install it into your projects but per the author some scripts need to be updated so it may take a little bit more to be available.
If you really need this fix you can checkout the branch and compile the library yourself and you would be able to add the dll manually.
You can see what was implemented for the fix in here: https://github.com/xamarin/Xamarin.Auth/pull/376
Thank you @JPSiller !
I'm using Xamarin.iOS 12.2.1.12 and I'm still having the problem.
Problem still exists with latest SDK, Forms and Auth... Please fix asap. These kind of bugs are annoying...
Having 2 apps to be published that are now just crashing, call this annoying..
Version
Steps to reproduce
Expected behaviour
Not throw.
Actual behaviour
Exception is thrown:
Inner exception:
I've tracked the issue down to https://github.com/xamarin/Xamarin.Auth/blob/b4fb1bb5c409e281c6bffad74ea8caba87805ea8/source/Core/Xamarin.Auth.XamarinIOS/AccountStore/KeyChainAccountStore.Aync.cs#L63-L69 where
GetField("True")
returnsnull
.