c# - Azure Mobile App service exception "The item does not exist" while InsertAsync -
i have interested situation. have class , table on azure:
public class inmeitem { public string id { get; set; } [jsonproperty(propertyname = "heartrate")] public string heartrate { get; set; } [jsonproperty(propertyname = "pulsewave")] public string pulsewave { get; set; } }
i have follow code insert new item table:
public static async task insertinmeitem(inmeitem inmeitem) { try { await app.mobileservice.gettable<inmeitem>().insertasync(inmeitem); } catch (microsoft.windowsazure.mobileservices.mobileserviceinvalidoperationexception ex) { debug.writeline("this f***** situation post data generate exception: " + ex.tostring()); } catch (exception ex) { debug.writeline(ex); } }
but have interested situation - running throw exception "the item not exist" data inserted in table on azure without exceptions
exception info:
this f***** situation post data generate exception: microsoft.windowsazure.mobileservices.mobileserviceinvalidoperationexception: item not exist @ microsoft.windowsazure.mobileservices.mobileservicehttpclient.<throwinvalidresponse>d__18.movenext() --- end of stack trace previous location exception thrown --- @ system.runtime.compilerservices.taskawaiter.throwfornonsuccess(task task) @ system.runtime.compilerservices.taskawaiter.handlenonsuccessanddebuggernotification(task task) @ microsoft.windowsazure.mobileservices.mobileservicehttpclient.<sendrequestasync>d__1d.movenext() --- end of stack trace previous location exception thrown --- @ system.runtime.compilerservices.taskawaiter.throwfornonsuccess(task task) @ system.runtime.compilerservices.taskawaiter.handlenonsuccessanddebuggernotification(task task) @ microsoft.windowsazure.mobileservices.mobileservicehttpclient.<requestasync>d__4.movenext() --- end of stack trace previous location exception thrown --- @ system.runtime.compilerservices.taskawaiter.throwfornonsuccess(task task) @ system.runtime.compilerservices.taskawaiter.handlenonsuccessanddebuggernotification(task task) @ microsoft.windowsazure.mobileservices.mobileservicetable.<>c__displayclass14.<<insertasync>b__13>d__16.movenext() --- end of stack trace previous location exception thrown --- @ system.runtime.compilerservices.taskawaiter.throwfornonsuccess(task task) @ system.runtime.compilerservices.taskawaiter.handlenonsuccessanddebuggernotification(task task) @ microsoft.windowsazure.mobileservices.mobileservicetable.<transformhttpexception>d__4d.movenext() --- end of stack trace previous location exception thrown --- @ system.runtime.compilerservices.taskawaiter.throwfornonsuccess(task task) @ system.runtime.compilerservices.taskawaiter.handlenonsuccessanddebuggernotification(task task) @ microsoft.windowsazure.mobileservices.mobileservicetable.<insertasync>d__1a.movenext() --- end of stack trace previous location exception thrown --- @ system.runtime.compilerservices.taskawaiter.throwfornonsuccess(task task) @ system.runtime.compilerservices.taskawaiter.handlenonsuccessanddebuggernotification(task task) @ microsoft.windowsazure.mobileservices.mobileservicetable`1.<transformhttpexception>d__41.movenext() --- end of stack trace previous location exception thrown --- @ system.runtime.compilerservices.taskawaiter.throwfornonsuccess(task task) @ system.runtime.compilerservices.taskawaiter.handlenonsuccessanddebuggernotification(task task) @ microsoft.windowsazure.mobileservices.mobileservicetable`1.<insertasync>d__b.movenext() --- end of stack trace previous location exception thrown --- @ system.runtime.compilerservices.taskawaiter.throwfornonsuccess(task task) @ system.runtime.compilerservices.taskawaiter.handlenonsuccessanddebuggernotification(task task) @ microsoft.windowsazure.mobileservices.mobileservicetable`1.<insertasync>d__5.movenext() --- end of stack trace previous location exception thrown --- @ system.runtime.compilerservices.taskawaiter.throwfornonsuccess(task task) @ system.runtime.compilerservices.taskawaiter.handlenonsuccessanddebuggernotification(task task) @ system.runtime.compilerservices.taskawaiter.getresult() @ inmetesting.models.backoffice.<insertinmeitem>d__2.movenext()
you need ensure returning correct results insert function, i.e. expects return inserted item. don't need return inserted item, must return render client, or framework return 404 instead message "the item not exist".
the first example succeeds because context.execute returns inserted item. in second example, item not being returned block of code in .then() call.
Comments
Post a Comment