WP8 (Monogame) problem with App42 storageService.FindAllDocuments call

0 votes
Hi,

We're porting our WP7 app to WP8 in Monogame.

In WP7 our APP42 setup is working perfectly, but in the WP8 Monogame build, we are getting problems related to the storageService.FindAllDocuments call.

After going through the code step by step we identified that the requestCallback in storageService.FindAllDocuments is causing the game to hang while loading, but it produces no errors in the output window. Can you please assist?

Thanks guys!
asked Jun 24, 2014 in App42 Cloud API-BaaS by more.karvonen (10 points)
Can you tell me that which SDK version you are working on and if possible than share the code details ?
Sure. We've tried a few of the SDKs (currently using App42_Windows_Phone_sdk_2.3) and have the same results with them all. Here's some code so you can see whats going on, let me know if you'd like to see more (sorry for the formatting):

    class GetDataHandler {

    // variables ---------------

        // holders ---

            AppDataManager appDataManager;
            Callback callback;
            Action<Object> doOnSuccess;
            Action<int> doOnFail;
            String userID;

    // constructor ---------------

        public GetDataHandler(AppDataManager a) {
        appDataManager=a;
        }

    // public setters ---------------

        public void setDoOnSuccess(Action<Object> a) {
        doOnSuccess=a;
        }

        public void setDoOnFail(Action<int> a) {
        doOnFail=a;
        }

    //------
        
        public void doIt(String userID_) {

            userID=userID_;   

            callback=new Callback();
            callback.setDoOnSuccess(doOnSuccess);
            callback.setDoOnFail(doOnFail);
            appDataManager.storageService.FindAllDocuments(Constants.shephertzCloudDatabaseName, "user_"+userID, callback); // error is occurring on the callback here

        }



Here is the callbacks setup:


class Callback : App42Callback {

    // holders ---

        GetDataHandler handler;
        Action<Object> doOnSuccess;
        Action<int> doOnFail;

    // public setters ---

        public void setHandler(GetDataHandler h) {
        handler=h;
        }

        public void setDoOnSuccess(Action<Object> a) {
        doOnSuccess=a;
        }

        public void setDoOnFail(Action<int> a) {
        doOnFail=a;
        }

    // events ---

        void App42Callback.OnException(App42Exception e) {
        System.Diagnostics.Debug.WriteLine("error: "+e.GetAppErrorCode()+" ------ "+e.GetHttpErrorCode()+" ------ "+e);
        if(doOnFail!=null) doOnFail(e.GetAppErrorCode());
        }

    //---------------

        void App42Callback.OnSuccess(Object response) {
        if(doOnSuccess!=null) doOnSuccess(response);
        }

    }
Hi,

Can you please run your code by just removing  Action<Object> doOnSuccess and Action<int> doOnFail. Check your output by Debug.WriteLine only.
Thanks for the reply Rahul, I've responded below.

1 Answer

0 votes

Hi,

Can you just print the logs that will help us to understand what is going wrong.

Just putting the Debug.WriteLine in your code.

Thanks.

answered Jun 25, 2014 by hs00105 (517 points)
Hi Himanshu, Thanks for getting back to me.

Per Rahuls advice, I stripped down the code (below), but its still hanging.
After checking both code sets with breakpoints, step by step, when it reaches the callback, it hangs. It only produces the following in the output panel when it hangs:
The thread 0xfe8 has exited with code 259 (0x103).
Step into: Stepping over non-user code 'kooky_troop.Utils.CallbackV2..ctor'

It doesnt print any exceptions msgs or the debugging lines that are in the success/exception results of the Callback Class.

Strangely, the original Monogame version code that I posted at the start of this thread works on some phone devices but this problem seems to be specific to certain devices(920, 925's so far). We've done testing for device & hardware related problems but couldn't identify any problems.

Code Revised:
        public void getUserFromCloud() {
            String userID=Helpful.getUniqueUserID();
            String email=userID+"@no_email.com";
            String password=userID+"_no_password";
            getUserFromCloud(userID, email, password);
        }

        public void getUserFromCloud(String userID, String userEmail, String userPassword) {
            root.user.userID=userID;

            if(Helpful.isNetworkAvailable()) {

            storageService.FindAllDocuments(Constants.shephertzCloudDatabaseName, "user_" + userID, new CallbackV2());
            }
            else
            {
            createNewUser();
            }
        }

    public class CallbackV2 : App42Callback
    {
        void App42Callback.OnException(App42Exception e)
        {
            Console.WriteLine("Exception Message : " + e);                //AppDataManager.instance.createNewUser();
        }

        void App42Callback.OnSuccess(Object response)
        {
            Storage storage = (Storage)response;
            IList<Storage.JSONDocument> jsonDocList = storage.GetJsonDocList();   

            // code temporarily removed
            //AppDataManager.instance.getDataFromCloud2();

            System.Diagnostics.Debug.WriteLine("Success!");    
        }
    }
Hi Karvonen,
 We have taken this  on priority  when it is replicated and fixed we will kindly inform you.
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...