AnsweredAssumed Answered

Problem with GeodatabaseSyncTask.GenerateGeodatabase with authentication

Question asked by Pscovis on Mar 6, 2017
Latest reply on Mar 8, 2017 by JNery-esristaff

My app is crashing when calling GeodatabaseSyncTask.GenerateGeodatabase, with a feature layer that requires authentication.  I have implemented a ChallengeHandler and registered it with the Esri AuthenticationManager.  My authentication code gets called, and a valid token is generated.


The GenerateGeodatabase job fires off several messages as it does its work:

"Job started."

"Creating server job."

"Sending request generate geodatabase on the server."

"Received response for generate geodatabase on the server."

"Getting server job status."

"Sending request generate geodatabase job status."

"Received response for generate geodatabase job status."

"Server job complete."

"Downloading from server."

"Sending request get geodatabase from server."

"Received response for get geodatabase from server."

"Download complete. Geodatabase path: C:\\Users\\pscovis\\AppData\\Local\\Packages\\96a4bdff-4352-4044-b135-a13377470910_c7d7ttxxmcvhj\\LocalState\\MapCache\\televisions.geodatabase"

"Job succeeded."


Then there is an uncaught exception that crashes the app.

No Data

at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Esri.ArcGISRuntime.Tasks.Job`1.<RuntimeCoreNet-GeneratedWrappers-ICoreCallback_Job_JobDone-JobDone>d__8.MoveNext()


The message "No Data" is similar to what I have experienced loading a layer from a corrupted .geodatabase file .  Sure enough, the .geodatabase file that was downloaded to the local system contains a short HTML response that looks like a server error.  It contains the text "Token Required", as though the token were never supplied to the service.


Am I doing something wrong that results in the token not being used in the offline sync request?  Does the sync method not check the response codes from the service?  Is the exception not being caught properly?  Does anyone else have problems using offline sync in conjunction with authentication?