Dans notre projet Xamarin actuel pour Android, nous voyons beaucoup de SIGSEGV dans le mono-rt pour nos tâches asynchrones. Voici un exemple de code qui génère environ 20% de fois SIGSEGV. On dirait que je fais quelque chose de fondamentalement faux ici ou il y a un problème sérieux avec Xamarin pour Android. Quelqu'un peut-il m'aider à signaler ce qui ne va pas avec ce code qui génère ce SIGSEGV?SIGSEV en tâches asynchrones sur Xamarin Android
Est-ce lié à https://bugzilla.xamarin.com/show_bug.cgi?id=13707?
EDIT: Je vois ce genre de comportement partout dans l'application maintenant. Voici un log file qui a d'autres erreurs. Tous les accidents se produisent sur le code de tâche asynchrone. Quelque chose ne va vraiment pas ici. Toute aide est appréciée.
public async Task GetDataAsync(string downloadUri) {
using (WebClient downloader = new WebClient()) {
downloader.Headers.Add ("x-bz-appId", "android");
downloader.Headers.Add ("x-bz-authToken", Comman.AuthToken);
downloader.Headers.Add(HttpRequestHeader.ContentType, "application/json");
var t = await downloader.DownloadStringTaskAsync(new Uri(downloadUri)).ContinueWith(downloadTask => {
if (downloadTask.Status == TaskStatus.RanToCompletion) {
JObject response = null;
response = JObject.Parse(downloadTask.Result);
return response;
} else {
if (downloadTask.Exception != null) {
throw downloadTask.Exception;
} else {
throw new Exception(downloadTask.Status.ToString());
}
}
});
return t;
}
}
[mono-rt] Stacktrace:
[mono-rt]
[mono-rt] at <0xffffffff>
[mono-rt] at (wrapper managed-to-native) object.__icall_wrapper_mono_array_new_specific (intptr,int)
[mono-rt] at System.Array.Resize (T[]&,int)
[mono-rt] at System.Collections.Generic.List`1.set_Capacity (int)
[mono-rt] at System.Collections.Generic.List`1.GrowIfNeeded (int)
[mono-rt] at System.Collections.Generic.List`1.Insert (int,T)
[mono-rt] at Newtonsoft.Json.Linq.JContainer.InsertItem (int,Newtonsoft.Json.Linq.JToken,bool)
[mono-rt] at Newtonsoft.Json.Linq.JProperty.InsertItem (int,Newtonsoft.Json.Linq.JToken,bool)
[mono-rt] at Newtonsoft.Json.Linq.JContainer.AddInternal (int,object,bool)
[mono-rt] at Newtonsoft.Json.Linq.JContainer.Add (object)
[mono-rt] at Newtonsoft.Json.Linq.JContainer.ReadContentFrom (Newtonsoft.Json.JsonReader)
[mono-rt] at Newtonsoft.Json.Linq.JContainer.ReadTokenFrom (Newtonsoft.Json.JsonReader)
[mono-rt] at Newtonsoft.Json.Linq.JObject.Load (Newtonsoft.Json.JsonReader)
[mono-rt] at Newtonsoft.Json.Linq.JObject.Parse (string)
[mono-rt] at Bloomz.Core.APIClient/c__async0/c__AnonStorey56.<>m__0 (System.Threading.Tasks.Task`1) [0x0004a] in /Users/hponnu/Projects/bloomz.native.android.2/Bloomz.Core/HelperClass/APIClient.cs:122
[mono-rt] at System.Threading.Tasks.TaskActionInvoker/FuncTaskInvoke`2.Invoke (System.Threading.Tasks.Task,object,System.Threading.Tasks.Task)
[mono-rt] at System.Threading.Tasks.Task.InnerInvoke()
[mono-rt] at System.Threading.Tasks.Task.ThreadStart()
[mono-rt] at System.Threading.Tasks.Task.Execute()
[mono-rt] at System.Threading.Tasks.TaskScheduler.TryExecuteTask (System.Threading.Tasks.Task)
[mono-rt] at System.Threading.Tasks.SynchronizationContextScheduler.TaskLaunchWrapper (object)
[mono-rt] at Android.App.SyncContext/c__AnonStorey0.<>m__0() [0x00000] in /Users/builder/data/lanes/1131/2a7b6821/source/monodroid/src/Mono.Android/src/Android.App/SyncContext.cs:18
[mono-rt] at Java.Lang.Thread/RunnableImplementor.Run() [0x0000b] in /Users/builder/data/lanes/1131/2a7b6821/source/monodroid/src/Mono.Android/src/Java.Lang/Thread.cs:36
[mono-rt] at Java.Lang.IRunnableInvoker.n_Run (intptr,intptr) [0x00009] in /Users/builder/data/lanes/1131/2a7b6821/source/monodroid/src/Mono.Android/platforms/android-12/src/generated/Java.Lang.IRunnable.cs:71
[mono-rt] at (wrapper dynamic-method) object.18db936a-f8a6-4eb0-838d-1159fbb9846c (intptr,intptr)
[mono-rt] at (wrapper native-to-managed) object.18db936a-f8a6-4eb0-838d-1159fbb9846c (intptr,intptr)
[mono-rt]
[mono-rt] =================================================================
[mono-rt] Got a SIGSEGV while executing native code. This usually indicates
[mono-rt] a fatal error in the mono runtime or one of the native libraries
[mono-rt] used by your application.
[mono-rt] =================================================================
[mono-rt]
Essayez-vous de courir sur le genymotion? – alexandrius
Oui, mais je vois les mêmes problèmes sur le téléphone aussi. Sur Genymotion, cela se produit à une fréquence plus élevée. – ponnu
Est-ce que vous obtenez le résultat de 'downloadTask' (downloadTask.Result)? Est-ce que l'exception survient avant cela? –