Support Topics Documentation Slack YouTube Blog

Downloading items from table returns: java.lang.RuntimeException: java.lang.NullPointerException

Backendless Version (3.x / 5.x, Online / Managed / Pro )

5.7.0

Client SDK (REST / Android / Objective-C / Swift / JS )

C# .net inside of Unity using the SDK found here:

Unity version: 19.2.17f
Scripting Backend: Mono
Api Compatibility Level: .NET 4.x

Application ID

E45A3A00-3001-2C22-FF90-2BE03E914500

Expected Behavior

Able to find items of the table CoreSampleData.

Actual Behavior

I did some light editing of one of my tables(CoreSampleData) schema, changed a couple column names, set a couple as indexed, added a DataObjetRelation and then removed it. Now on the .net client side when I try download items from that table with default paging Backendless server returns an exception java.lang.RuntimeException: java.lang.NullPointerException

I’ve tried deleting the table and recreating it by pushing a few items from the client (leaving the auto created schema intact this time) but the issue persists.
I’m using the Basic Non-blocking CustomClass version of the Find method found here:
https://backendless.com/docs/dotnet/data_basic_search.html

It works for all my other tables and FindById works on the troublesome table but the default find example just throws a null exception on the java side.

Reproducible Test Case

AsyncCallback<IList<CoreSampleData>> getCoreSample =
  new AsyncCallback<IList<CoreSampleData>>(
    foundCoreSamples =>
    {
        Debug.Log("Found  " + foundCoreSamples.Count + " Core Samples");

        foreach (var item in foundCoreSamples)
        {
            Debug.Log("Found CoreSample " + item.title);
        }
    },
    error =>
    {
        Debug.LogError("Server returned an error " + error.Message);
    });

Backendless.Data.Of<CoreSampleData>().Find(getCoreSample);

with this example I get the console output:

Server returned an error java.lang.RuntimeException: java.lang.NullPointerException
UnityEngine.Debug:LogError(Object)
<>c:<DownloadCoreSamples>b__9_1(BackendlessFault) (at Assets/[ExperimentalDesign]/Code/StandAloneCalloutEditor/TempTagCreator.cs:82)
BackendlessAPI.Service.<>c__DisplayClass47_0`1:<Find>b__1(BackendlessFault)
BackendlessAPI.Engine.<>c__DisplayClass10_0`1:<InvokeAsync>b__1(Fault)
Weborb.Client.HttpEngine:ProcessAMFResponse(IAsyncResult)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:SetResult(Int32)
Mono.Net.Security.<StartOperation>d__58:MoveNext()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:SetResult(AsyncProtocolResult)
Mono.Net.Security.<StartOperation>d__23:MoveNext()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder:SetResult()
Mono.Net.Security.<ProcessOperation>d__24:MoveNext()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:SetResult(Nullable`1)
Mono.Net.Security.<InnerRead>d__25:MoveNext()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:SetResult(Int32)
Mono.Net.Security.<InnerRead>d__66:MoveNext()
System.Threading._ThreadPoolWaitCallback:PerformWaitCallback()

Using the dictionary approach over the custom class approach returns the same NullReference exception
AsyncCallback<IList<Dictionary<string, object>>> callback;
callback = new AsyncCallback<IList<Dictionary<string, object>>>(
foundCoreSamples =>
{
Debug.Log(“Found " + foundCoreSamples.Count + " Core Samples”);
},
error =>
{
Debug.LogError(error.Message);
Debug.LogError(error.Detail);
Debug.LogError(error.FaultCode);
});

Backendless.Data.Of("CoreSampleData").Find(callback);

Doing a basic query in the rest console in the admin site does work without error, however that doesn’t help much on the .net side.

Hello,

Could you please share the CoreSampleData class with us?

Regards,
Mark

[System.Serializable]
public class CloudDataObject
{
    public string objectId { get; set; }
    public System.DateTime created { get; set; }
    public System.DateTime updated { get; set; }
}
[System.Serializable]
public class CoreSampleData : CloudDataObject
{
    public string title;
    public string description;
    public string provocation;
    public int yearOfSpeculation = 2020;

    public string cantoFolderLinkId;
    public string cantoAlbumLinkId;

    public string prefabAddress;

    public List<WeightedRelation> domainWeights;
    public string domainWeights_Encoded;
    public List<WeightedRelation> lensesWeights;
    public string lensWeights_Encoded;
    public List<WeightedRelation> focusAreasWeights;
    public string focusAreaWeights_Encoded;
}



[System.Serializable]
public class WeightedRelation
{
    public string releatedId;
    public int weight;
}

Thank you. I will try it out over the weekend. Is the app in development or production?

Development

We released a proof of concept version last oct, which the client is using in the wild now but that version had no cloud connected features. This expanded version is very much currently in development.

Any luck over the weekend?

Ok so some progress. If I use the DataQueryBuilder interface and give it a where clause that catches everything in the table it seems to work. No null ref and everything downloads.

Debug.Log("Downloading CoreSamples");
string whereClause = "yearOfSpeculation > 2000";
DataQueryBuilder queryBuilder = DataQueryBuilder.Create();
queryBuilder.SetWhereClause(whereClause);


AsyncCallback< IList < CoreSampleData >> callback;
    callback = new AsyncCallback<IList<CoreSampleData>>(
    foundCoreSamples =>
    {
        Debug.Log("Found  " + foundCoreSamples.Count + " Core Samples");
    },
    error =>
    {
        Debug.LogError(error.Message);
        Debug.LogError(error.Detail);
        Debug.LogError(error.FaultCode);
    });

Backendless.Data.Of<CoreSampleData>().Find(queryBuilder,callback);

So at least for now unblocked. But it would still be good to figure out why the basic call without a clause fails.

The problem has been resolved in the 5.2.0 build of the unity package.