Hi, I have a droid project and a core project in net standard 2.0. I've using firebase for the backend and MVVM cross to comunicate the parts.
I create a service with basic crud operations using generics:
public async Task<IReadOnlyCollection<FirebaseObject<T>>> GetAll <T(string endpoint)
where T: class
{
var token = _storageService.GetToken();
var res = await this._firebaseClient
.Child(endpoint)
.WithAuth(token.AccessToken)
.OnceAsync<T>();
return res;
}
The idea is call this method from different view models but doesn't works, I've implemented in this way:
In ctor of viewmodel:
public TasksViewModel(
IMvxNavigationService navigationService,
IBasicCRUDService crudService)
{
this.navigationService = navigationService;
this._crudService = crudService;
this.LoadTasksCommand = new MvxAsyncCommand(this.LoadTasks);
}
And the method:
public IMvxAsyncCommand LoadTasksCommand { get; private set; }
public async System.Threading.Tasks.Task LoadTasks()
{
var res = await _crudService.GetAll<Models.Task>("tasks");
}
But when the call to firebase in BasicCrudService occurrs, the app stop working and throws this error:
(23746): /Users/builder/jenkins/workspace/xamarin-android-d15-7/xamarin-android/external/mono/mono/mini/debugger-agent.c:4923: Could not execute the method because the containing type is not fully instantiated. assembly: type: member:(null) signature: <none>
(23746): Fatal signal 6 (SIGABRT), code -6 in tid >23746 (ame.Doing_Droid)
Any idea?.
Thanks to all and sorry for mi bad English!