.NET issue: .FindById("<objectId>", <asyncCallback>) causing NullPointerException in weborb.dll

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&lt;T&gt; FindByIdAsync&lt;T&gt;(this IDataStore&lt;T&gt; dataStore, string objectId) where T : class
        {
            return await Task.Run(() =>
            {
                var taskCompletionSource = new TaskCompletionSource&lt;T&gt;();


                var asyncCallback = new AsyncCallback&lt;T&gt;(
                    response =>
                    {
                        taskCompletionSource.SetResult(response);
                    },
                    error =>
                    {
                        taskCompletionSource.SetResult(null);
                    });


                Backendless.Persistence.Of&lt;T&gt;().FindById(objectId, asyncCallback);


                return taskCompletionSource.Task;
            });
        }

which is called via:

var province = await Backendless.Persistence.Of&lt;Province&gt;().FindByIdAsync(selectedProvinceId);

I’ve also tried doing it in the Controller (not in a helper method):

            Province p = null;
            var responder = new AsyncCallback&lt;Province&gt;(
                response =>
                {
                    p = response;
                },
                error =>
                {
                    p = null;
                });
            Backendless.Persistence.Of&lt;Province&gt;().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.

Hi Justin,

If you grab the latest build from github (or build the assembly from the sources), then the weborb dependency is not going to be required at all. Here’s the assembly build:

Regards,
Mark

Since I’m using .NET 4.5, could there be any issues with using the .NET 4.0 build you linked to?

It it not going to be a problem at all since 4.5 is backwards compatible with 4.0

Regards,
Mark