Hi,
I’ve tried extrapolating the Save and Find actions into async helper methods with no problems, but trying to do the same with FindById(string id, AsyncCallback<T> responder) encounters a NullPointerException in weborb.dll:
public static async Task<T> FindByIdAsync<T>(this IDataStore<T> dataStore, string objectId) where T : class
{
return await Task.Run(() =>
{
var taskCompletionSource = new TaskCompletionSource<T>();
var asyncCallback = new AsyncCallback<T>(
response =>
{
taskCompletionSource.SetResult(response);
},
error =>
{
taskCompletionSource.SetResult(null);
});
Backendless.Persistence.Of<T>().FindById(objectId, asyncCallback);
return taskCompletionSource.Task;
});
}
which is called via:
var province = await Backendless.Persistence.Of<Province>().FindByIdAsync(selectedProvinceId);
I’ve also tried doing it in the Controller (not in a helper method):
Province p = null;
var responder = new AsyncCallback<Province>(
response =>
{
p = response;
},
error =>
{
p = null;
});
Backendless.Persistence.Of<Province>().FindById(objectId, responder);
and, unsurprisingly, it encounters a NullPointerException in weborb.dll.
FYI, I’m using C# 6, .NET 4.5, VisualStudio Community 2015, and I downloaded the Windows SDK from your site today (January 2nd, 2016).
Regards,
Justin C.