【发布时间】:2018-12-03 19:36:15
【问题描述】:
我收到上述错误:System.AggregateException: One or more errors occurred.
这里有这行代码:
List<tblDeviceIds> installIDs = KumulosHelper.Functions.Device.GetDeviceIDsOfUser(toUser);
方法“GetDeviceIdsOfUser”如下所示:
public static List<tblDeviceIds> GetDeviceIDsOfUser(string username)
{
IDictionary<string, string> myDict = new Dictionary<string, string>();
myDict.Add("username", username);
return KumulosGeneral.getTblDeviceIds("getDeviceIDsOfUser", myDict);
}
所以,真的没有什么花哨的事情发生。
有时,但仅限于某些用户出现上述错误。因此,即使用户是“null”,而他从来不是,列表也不会返回任何内容。但相反,它崩溃了。这本身就是我不太明白的事情,所以我所做的是:
List<tblDeviceIds> installIDs = null;
try
{
installIDs = KumulosHelper.Functions.Device.GetDeviceIDsOfUser(toUser);
}
catch
{
installIDs = null;
}
这将是一个子弹证明的解决方法,但是:它进入 try,它崩溃,它永远不会进入 catch,它已经死了。 有人愿意解释一下吗?
谢谢!
哦,也许这与在另一个线程上执行此操作有关?这是调用所有这些的函数:
await Task.Run(() =>
{
Intermediate.SendMessageToUser(toUsername, temp);
});
如您所见,它位于异步任务中……但这应该不是问题,对吧?
【问题讨论】:
标签: android android-asynctask xamarin.android