我正在开发一个与sockets.io API集成的mvc.asp项目。
我的主控制器中有一个操作,它向外部API发出请求并获取JSON格式的数据(这部分工作正常)。
当我让visual studio从头到尾运行时,一切正常,但是当我尝试调试阶段 AFTER 获取数据时,visual stdio只会暂停几分钟(甚至可能完全卡住) ,如果我点击暂停按钮,它将显示它即将调用一个函数或进行一个非常基本的字符串操作,但它不会,而只是挂起。
我已经添加了一些代码(因为我不确定它是否相关)。
private ActionParams GetAction(int tabID, int startIndex, HashSet<string> existsUsers)
{
ActionParams aParams = new ActionParams();
string data = VmtDevAPI.GetActionHistory(tabID, startIndex); //api call which returns json
var results = JsonConvert.DeserializeObject<dynamic>(data); //desiralize
// **things start getting crazy from this point on** it can get stuck on any of the next lines
foreach (var item in results)
{
if (item.eventData != null
&& item.eventName != null
&& item.userName != null
&& item.timeStamp != null
&& item.id != null
&& item.eventData.xml != null
)
{
string url = item.eventData.xml;
XmlObject xml = new XmlObject(url);
string timeStamp = item.timeStamp.Value.ToString().Trim();
...
}
}
如果有人建议我应该检查什么,我真的很感激。在编写这些行之前,我确实检查了很多选项,但到目前为止似乎没有任何工作。