Skip to content

Instantly share code, notes, and snippets.

@alexshikov
Last active August 21, 2018 15:30
Show Gist options
  • Save alexshikov/7b3f724fdd6a98f346a0a9993229412c to your computer and use it in GitHub Desktop.
Save alexshikov/7b3f724fdd6a98f346a0a9993229412c to your computer and use it in GitHub Desktop.
Fix an issue when update Xamarin.Auth NuGet from 1.5.x to 1.6.x
// Workaround
public static class AccountStoreFix
{
// Replace default construction with Android fix in the MainActivity.cs
public static Func<AccountStore> CreateFunc = AccountStore.Create;
public static AccountStore Create ()
{
return CreateFunc ();
}
}
// Usage
public class Storage
{
public void Save ()
{
// Now just replace AccountStore.Create() with AccountStoreFix.Create() everywhere
var store = AccountStoreFix.Create();
// ...
}
}
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
protected override void OnCreate (Bundle bundle)
{
TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar;
base.OnCreate (bundle);
AccountStoreFix.CreateFunc = () => Xamarin.Auth.AccountStore.Create ("System.Char[]");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment